Files
go-i2ptunnel/lib/core/doc.md
2025-02-10 00:36:58 -05:00

1.7 KiB

i2ptunnel

-- import "github.com/go-i2p/go-i2ptunnel/lib/core"

Usage

func Clean

func Clean(name string) string

Clean the name to form an ID change newlines to + change tabs to _ change spaces to - erase foreslashes

type I2PTunnel

type I2PTunnel interface {
	// Start the tunnel
	Start() error
	// Stop the tunnel
	Stop() error
	// Get the tunnel's name
	Name() string
	// Get the tunnel's ID
	ID() string
	// Get the tunnel's type
	Type() string
	// Get the tunnel's I2P address
	Address() string
	// Get the tunnel's I2P target. Nil in the case of one-to-many clients like SOCKS5 and HTTP
	Target() string
	// Get the tunnel's options
	Options() map[string]string
	// Set the tunnel's options
	SetOptions(map[string]string) error
	// Load the tunnel config
	LoadConfig(path string) error
	// Get the tunnel's status
	Status() I2PTunnelStatus
	// Get the tunnel's error message
	Error() error
	// Get the tunnel's local host:port
	LocalAddress() (string, error)
}

type I2PTunnelError

type I2PTunnelError struct {
}

func NewError

func NewError(tun I2PTunnel, err error) I2PTunnelError

func (I2PTunnelError) Error

func (i I2PTunnelError) Error() string

type I2PTunnelStatus

type I2PTunnelStatus string
const (
	// Tunnel is running
	I2PTunnelStatusRunning I2PTunnelStatus = "running"
	// Tunnel is stopped
	I2PTunnelStatusStopped I2PTunnelStatus = "stopped"
	// Tunnel is starting
	I2PTunnelStatusStarting I2PTunnelStatus = "starting"
	// Tunnel is stopping
	I2PTunnelStatusStopping I2PTunnelStatus = "stopping"
	// Tunnel is failed
	I2PTunnelStatusFailed I2PTunnelStatus = "failed"
	// Tunnel is unknown
	I2PTunnelStatusUnknown I2PTunnelStatus = "unknown"
)