wg

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPeerFlag = errors.New("not a valid peer flag value")
View Source
var Logger = &device.Logger{
	Verbosef: func(format string, args ...any) { caddy.Log().Debug(fmt.Sprintf(format, args...), _WG) },
	Errorf:   func(format string, args ...any) { caddy.Log().Error(fmt.Sprintf(format, args...), _WG) },
}

Functions

func ResetDNSCache

func ResetDNSCache()

Types

type ApiInterfacePrivateKey

type ApiInterfacePrivateKey Key

func (ApiInterfacePrivateKey) GetKey

func (ApiInterfacePrivateKey) GetKey() string

func (ApiInterfacePrivateKey) GetValue

func (k ApiInterfacePrivateKey) GetValue() string

type ApiListenPort

type ApiListenPort uint16

func (ApiListenPort) GetKey

func (ApiListenPort) GetKey() string

func (ApiListenPort) GetValue

func (p ApiListenPort) GetValue() string

type ApiPeerAllowedIPs

type ApiPeerAllowedIPs string

func (ApiPeerAllowedIPs) GetKey

func (ApiPeerAllowedIPs) GetKey() string

func (ApiPeerAllowedIPs) GetValue

func (k ApiPeerAllowedIPs) GetValue() string

type ApiPeerEndpoint

type ApiPeerEndpoint struct {
	Host IPv4
	Port Port
}

func (ApiPeerEndpoint) GetKey

func (ApiPeerEndpoint) GetKey() string

func (ApiPeerEndpoint) GetValue

func (e ApiPeerEndpoint) GetValue() string

func (*ApiPeerEndpoint) String

func (e *ApiPeerEndpoint) String() string

func (*ApiPeerEndpoint) UnmarshalText

func (e *ApiPeerEndpoint) UnmarshalText(text []byte) error

type ApiPeerPersistentKeepalive

type ApiPeerPersistentKeepalive uint

func (ApiPeerPersistentKeepalive) GetKey

func (ApiPeerPersistentKeepalive) GetValue

func (p ApiPeerPersistentKeepalive) GetValue() string

type ApiPeerPreSharedKey

type ApiPeerPreSharedKey Key

func (ApiPeerPreSharedKey) GetKey

func (ApiPeerPreSharedKey) GetKey() string

func (ApiPeerPreSharedKey) GetValue

func (k ApiPeerPreSharedKey) GetValue() string

type ApiPeerPublicKey

type ApiPeerPublicKey Key

func (ApiPeerPublicKey) GetKey

func (ApiPeerPublicKey) GetKey() string

func (ApiPeerPublicKey) GetValue

func (k ApiPeerPublicKey) GetValue() string

type ApiReplacePeers

type ApiReplacePeers bool

func (ApiReplacePeers) GetKey

func (ApiReplacePeers) GetKey() string

func (ApiReplacePeers) GetValue

func (k ApiReplacePeers) GetValue() string

type ClientConfig

type ClientConfig struct {
	Private             Key
	Public              Key
	PreShared           Key
	Endpoint            ApiPeerEndpoint
	PersistentKeepalive uint32
	AllowedIPs          string
}

func (*ClientConfig) WGConfig

func (cfg *ClientConfig) WGConfig() string

type Configable

type Configable interface{ WGConfig() string }

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(tunnel tun.Device, cfg Configable) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Down

func (c *Connection) Down() error

func (*Connection) SetConfig

func (c *Connection) SetConfig(cfg Configable) error

func (*Connection) Transfer

func (c *Connection) Transfer() (*Transfer, error)

func (*Connection) Up

func (c *Connection) Up() error

type IPv4

type IPv4 [4]byte

func (*IPv4) MarshalJSON

func (ipv4 *IPv4) MarshalJSON() ([]byte, error)

func (*IPv4) Put

func (ipv4 *IPv4) Put(dst []byte)

func (*IPv4) Set

func (ipv4 *IPv4) Set(src []byte)

func (*IPv4) String

func (ipv4 *IPv4) String() string

func (*IPv4) UnmarshalBinary

func (ipv4 *IPv4) UnmarshalBinary(data []byte) error

func (*IPv4) UnmarshalJSON

func (ipv4 *IPv4) UnmarshalJSON(data []byte) error

func (*IPv4) UnmarshalText

func (ipv4 *IPv4) UnmarshalText(data []byte) error

type IpcKeyValue

type IpcKeyValue interface {
	GetKey() string
	GetValue() string
}

type IpcRequest

type IpcRequest []IpcKeyValue

func (IpcRequest) WGConfig

func (ir IpcRequest) WGConfig() string

type Key

type Key [32]byte

func PubKey

func PubKey(private Key) (key Key)

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(data []byte) error

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(text []byte) error

type Port

type Port uint16

func (*Port) UnmarshalText

func (p *Port) UnmarshalText(text []byte) error

type ServerConfig

type ServerConfig struct {
	Private    Key
	Address    IPv4
	Peer       ServerPeers
	ListenPort uint16
}

func (*ServerConfig) WGConfig

func (cfg *ServerConfig) WGConfig() string

type ServerPeer

type ServerPeer struct {
	Public    Key
	PreShared Key
	Address   IPv4
}

func (*ServerPeer) PeerElems

func (*ServerPeer) PeerElems() int

type ServerPeers

type ServerPeers []*ServerPeer

type Transfer

type Transfer struct {
	Rx uint64
	Tx uint64
}

func (*Transfer) String

func (t *Transfer) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL