Documentation ¶
Index ¶
- Variables
- type Config
- type Tunnel
- func (t *Tunnel) Addr() net.Addr
- func (t *Tunnel) Close() error
- func (t *Tunnel) FromAddr() string
- func (t *Tunnel) IsClosed() bool
- func (t *Tunnel) MultiClient() *nkn.MultiClient
- func (t *Tunnel) SetAcceptAddrs(addrsRe *nkngomobile.StringArray) error
- func (t *Tunnel) Start() error
- func (t *Tunnel) ToAddr() string
- func (t *Tunnel) TunaPubAddrs() *ts.PubAddrs
- func (t *Tunnel) TunaSessionClient() *ts.TunaSessionClient
Constants ¶
This section is empty.
Variables ¶
var (
ErrUDPNotSupported = errors.New("UDP is only supported in tuna mode")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.1
type Config struct { NumSubClients int OriginalClient bool AcceptAddrs *nkngomobile.StringArray ClientConfig *nkn.ClientConfig WalletConfig *nkn.WalletConfig DialConfig *nkn.DialConfig TunaSessionConfig *ts.Config UDP bool UDPIdleTime int32 // Seconds. Time to purge idle udp connections, 0 is for no purge. Verbose bool TunaNode *types.Node }
func DefaultConfig ¶ added in v0.2.1
func DefaultConfig() *Config
func MergedConfig ¶ added in v0.2.1
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel is the tunnel client struct.
func NewTunnel ¶
func NewTunnel(account *nkn.Account, identifier, from, to string, tuna bool, config *Config, mc *nkn.MultiClient) (*Tunnel, error)
NewTunnel creates a Tunnel client with given options.
func NewTunnels ¶ added in v0.3.5
func NewTunnels(account *nkn.Account, identifier string, from, to []string, tuna bool, config *Config, mc *nkn.MultiClient) ([]*Tunnel, error)
NewTunnels creates Tunnel clients with given options. If argument `mc` is nil, then a new MultiClient will be created based on `account` and `identifier`.
func (*Tunnel) MultiClient ¶ added in v0.3.1
func (t *Tunnel) MultiClient() *nkn.MultiClient
MultiClient returns the NKN multiclient that tunnel creates and uses.
func (*Tunnel) SetAcceptAddrs ¶ added in v0.2.1
func (t *Tunnel) SetAcceptAddrs(addrsRe *nkngomobile.StringArray) error
SetAcceptAddrs updates the accept address regex for incoming sessions. Tunnel will accept sessions from address that matches any of the given regular expressions. If addrsRe is nil, any address will be accepted. Each function call will overwrite previous accept addresses.
func (*Tunnel) TunaPubAddrs ¶ added in v0.3.0
TunaPubAddrs returns the public node info of tuna listeners. Returns nil if there is no tuna listener.
func (*Tunnel) TunaSessionClient ¶ added in v0.3.1
func (t *Tunnel) TunaSessionClient() *ts.TunaSessionClient
TunaSessionClient returns the tuna session client that tunnel creates and uses. It is not nil only if tunnel is created with tuna == true.