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

93 lines
1.7 KiB
Markdown

# i2ptunnel
--
import "github.com/go-i2p/go-i2ptunnel/lib/core"
## Usage
#### func Clean
```go
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
```go
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
```go
type I2PTunnelError struct {
}
```
#### func NewError
```go
func NewError(tun I2PTunnel, err error) I2PTunnelError
```
#### func (I2PTunnelError) Error
```go
func (i I2PTunnelError) Error() string
```
#### type I2PTunnelStatus
```go
type I2PTunnelStatus string
```
```go
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"
)
```