Documentation ¶
Index ¶
- func NewConnection(opts Options, ipResolver ip.Resolver, endpointFactory wg.EndpointFactory, ...) (connection.Connection, error)
- type Connection
- func (c *Connection) GetConfig() (connection.ConsumerConfig, error)
- func (c *Connection) Reconnect(ctx context.Context, options connection.ConnectOptions) error
- func (c *Connection) Start(ctx context.Context, options connection.ConnectOptions) error
- func (c *Connection) State() <-chan connectionstate.State
- func (c *Connection) Statistics() (connectionstate.Statistics, error)
- func (c *Connection) Stop()
- type HandshakeWaiter
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection ¶
func NewConnection(opts Options, ipResolver ip.Resolver, endpointFactory wg.EndpointFactory, handshakeWaiter HandshakeWaiter) (connection.Connection, error)
NewConnection returns new WireGuard connection.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection which does wireguard tunneling.
func (*Connection) GetConfig ¶
func (c *Connection) GetConfig() (connection.ConsumerConfig, error)
GetConfig returns the consumer configuration for session creation
func (*Connection) Reconnect ¶
func (c *Connection) Reconnect(ctx context.Context, options connection.ConnectOptions) error
Reconnect restarts a connection with a new options.
func (*Connection) Start ¶
func (c *Connection) Start(ctx context.Context, options connection.ConnectOptions) error
Start establish wireguard connection to the service provider.
func (*Connection) State ¶
func (c *Connection) State() <-chan connectionstate.State
State returns connection state channel.
func (*Connection) Statistics ¶
func (c *Connection) Statistics() (connectionstate.Statistics, error)
Statistics returns connection statistics channel.
func (*Connection) Stop ¶
func (c *Connection) Stop()
Stop stops wireguard connection and closes connection endpoint.
type HandshakeWaiter ¶
type HandshakeWaiter interface { // Wait waits until WireGuard does initial handshake. Wait(ctx context.Context, statsFetch func() (wgcfg.Stats, error), timeout time.Duration, stop <-chan struct{}) error }
HandshakeWaiter waits for handshake.
func NewHandshakeWaiter ¶
func NewHandshakeWaiter() HandshakeWaiter
NewHandshakeWaiter returns handshake waiter instance.
Click to show internal directories.
Click to hide internal directories.