Documentation
¶
Index ¶
- Variables
- func NewDeviceLoggerAdapter() *device.Logger
- func NewNetPacketConnToWg(c net.PacketConn) conn.Bind
- type DeviceConfig
- func (*DeviceConfig) Descriptor() ([]byte, []int)deprecated
- func (x *DeviceConfig) GetListenPort() uint32
- func (x *DeviceConfig) GetMtu() uint32
- func (x *DeviceConfig) GetPeers() []*PeerConfig
- func (x *DeviceConfig) GetPrivateKey() []byte
- func (*DeviceConfig) ProtoMessage()
- func (x *DeviceConfig) ProtoReflect() protoreflect.Message
- func (x *DeviceConfig) Reset()
- func (x *DeviceConfig) String() string
- type NetworkLayerDeviceToWireguardTunDeviceAdaptor
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) BatchSize() int
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Close() error
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Events() <-chan tun.Event
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) File() *os.File
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) MTU() (int, error)
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Name() (string, error)
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Read(bufs [][]byte, sizes []int, offset int) (ret int, err error)
- func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Write(bufs [][]byte, offset int) (int, error)
- type PeerConfig
- func (*PeerConfig) Descriptor() ([]byte, []int)deprecated
- func (x *PeerConfig) GetAllowedIps() []string
- func (x *PeerConfig) GetEndpoint() string
- func (x *PeerConfig) GetPersistentKeepaliveInterval() int64
- func (x *PeerConfig) GetPresharedKey() []byte
- func (x *PeerConfig) GetPublicKey() []byte
- func (*PeerConfig) ProtoMessage()
- func (x *PeerConfig) ProtoReflect() protoreflect.Message
- func (x *PeerConfig) Reset()
- func (x *PeerConfig) String() string
- type WrappedWireguardDevice
- func (w *WrappedWireguardDevice) AddOrReplacePeers(peers []*PeerConfig) error
- func (w *WrappedWireguardDevice) Close() error
- func (w *WrappedWireguardDevice) Debug() (string, error)
- func (w *WrappedWireguardDevice) InitDevice() error
- func (w *WrappedWireguardDevice) RemovePeer(publicKey []byte) error
- func (w *WrappedWireguardDevice) SetConn(c net.PacketConn)
- func (w *WrappedWireguardDevice) SetTunnel(t packetswitch.NetworkLayerDevice)
- func (w *WrappedWireguardDevice) SetupDeviceWithoutPeers() error
- func (w *WrappedWireguardDevice) Up() error
Constants ¶
This section is empty.
Variables ¶
var File_proxy_wireguard_wgcommon_config_proto protoreflect.FileDescriptor
Functions ¶
func NewDeviceLoggerAdapter ¶
NewDeviceLoggerAdapter returns a wireguard device.Logger that forwards verbose and error logs into the project's error logger using errors.New(...). Verbosef logs are recorded as Debug, Errorf logs are recorded as Error. machine generated
func NewNetPacketConnToWg ¶
func NewNetPacketConnToWg(c net.PacketConn) conn.Bind
NewNetPacketConnToWg constructs a wireguard conn.Bind adapter from a common/net.PacketConn. It returns a Bind implementation that delegates reads/writes to the provided PacketConn.
Important: the Bind does NOT own the PacketConn lifecycle. WireGuard calls Close() + Open() internally during BindUpdate(); Close() here only marks the bind as logically closed without closing the underlying conn, so that Open() can re-use it.
Types ¶
type DeviceConfig ¶
type DeviceConfig struct {
PrivateKey []byte `protobuf:"bytes,1,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
ListenPort uint32 `protobuf:"varint,3,opt,name=listen_port,json=listenPort,proto3" json:"listen_port,omitempty"`
Peers []*PeerConfig `protobuf:"bytes,4,rep,name=peers,proto3" json:"peers,omitempty"`
Mtu uint32 `protobuf:"varint,5,opt,name=mtu,proto3" json:"mtu,omitempty"`
// contains filtered or unexported fields
}
func (*DeviceConfig) Descriptor
deprecated
func (*DeviceConfig) Descriptor() ([]byte, []int)
Deprecated: Use DeviceConfig.ProtoReflect.Descriptor instead.
func (*DeviceConfig) GetListenPort ¶
func (x *DeviceConfig) GetListenPort() uint32
func (*DeviceConfig) GetMtu ¶
func (x *DeviceConfig) GetMtu() uint32
func (*DeviceConfig) GetPeers ¶
func (x *DeviceConfig) GetPeers() []*PeerConfig
func (*DeviceConfig) GetPrivateKey ¶
func (x *DeviceConfig) GetPrivateKey() []byte
func (*DeviceConfig) ProtoMessage ¶
func (*DeviceConfig) ProtoMessage()
func (*DeviceConfig) ProtoReflect ¶
func (x *DeviceConfig) ProtoReflect() protoreflect.Message
func (*DeviceConfig) Reset ¶
func (x *DeviceConfig) Reset()
func (*DeviceConfig) String ¶
func (x *DeviceConfig) String() string
type NetworkLayerDeviceToWireguardTunDeviceAdaptor ¶
type NetworkLayerDeviceToWireguardTunDeviceAdaptor struct {
// contains filtered or unexported fields
}
NetworkLayerDeviceToWireguardTunDeviceAdaptor is primarily machine generated.
func NewNetworkLayerDeviceToWireguardTunDeviceAdaptor ¶
func NewNetworkLayerDeviceToWireguardTunDeviceAdaptor(mtu int, networkLayerSwitch packetswitch.NetworkLayerDevice, batchSize int, inboundChannelSize int) (*NetworkLayerDeviceToWireguardTunDeviceAdaptor, error)
func (*NetworkLayerDeviceToWireguardTunDeviceAdaptor) BatchSize ¶
func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) BatchSize() int
func (*NetworkLayerDeviceToWireguardTunDeviceAdaptor) Close ¶
func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Close() error
func (*NetworkLayerDeviceToWireguardTunDeviceAdaptor) Events ¶
func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Events() <-chan tun.Event
func (*NetworkLayerDeviceToWireguardTunDeviceAdaptor) File ¶
func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) File() *os.File
func (*NetworkLayerDeviceToWireguardTunDeviceAdaptor) MTU ¶
func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) MTU() (int, error)
func (*NetworkLayerDeviceToWireguardTunDeviceAdaptor) Name ¶
func (n *NetworkLayerDeviceToWireguardTunDeviceAdaptor) Name() (string, error)
type PeerConfig ¶
type PeerConfig struct {
PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
AllowedIps []string `protobuf:"bytes,3,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
PersistentKeepaliveInterval int64 `` /* 145-byte string literal not displayed */
// contains filtered or unexported fields
}
func (*PeerConfig) Descriptor
deprecated
func (*PeerConfig) Descriptor() ([]byte, []int)
Deprecated: Use PeerConfig.ProtoReflect.Descriptor instead.
func (*PeerConfig) GetAllowedIps ¶
func (x *PeerConfig) GetAllowedIps() []string
func (*PeerConfig) GetEndpoint ¶
func (x *PeerConfig) GetEndpoint() string
func (*PeerConfig) GetPersistentKeepaliveInterval ¶
func (x *PeerConfig) GetPersistentKeepaliveInterval() int64
func (*PeerConfig) GetPresharedKey ¶
func (x *PeerConfig) GetPresharedKey() []byte
func (*PeerConfig) GetPublicKey ¶
func (x *PeerConfig) GetPublicKey() []byte
func (*PeerConfig) ProtoMessage ¶
func (*PeerConfig) ProtoMessage()
func (*PeerConfig) ProtoReflect ¶
func (x *PeerConfig) ProtoReflect() protoreflect.Message
func (*PeerConfig) Reset ¶
func (x *PeerConfig) Reset()
func (*PeerConfig) String ¶
func (x *PeerConfig) String() string
type WrappedWireguardDevice ¶
type WrappedWireguardDevice struct {
// contains filtered or unexported fields
}
func NewWrappedWireguardDevice ¶
func NewWrappedWireguardDevice(ctx context.Context, config *DeviceConfig) (*WrappedWireguardDevice, error)
func (*WrappedWireguardDevice) AddOrReplacePeers ¶
func (w *WrappedWireguardDevice) AddOrReplacePeers(peers []*PeerConfig) error
func (*WrappedWireguardDevice) Close ¶
func (w *WrappedWireguardDevice) Close() error
func (*WrappedWireguardDevice) Debug ¶
func (w *WrappedWireguardDevice) Debug() (string, error)
func (*WrappedWireguardDevice) InitDevice ¶
func (w *WrappedWireguardDevice) InitDevice() error
func (*WrappedWireguardDevice) RemovePeer ¶
func (w *WrappedWireguardDevice) RemovePeer(publicKey []byte) error
func (*WrappedWireguardDevice) SetConn ¶
func (w *WrappedWireguardDevice) SetConn(c net.PacketConn)
SetConn sets the underlying packet connection used by the wrapped WireGuard device.
func (*WrappedWireguardDevice) SetTunnel ¶
func (w *WrappedWireguardDevice) SetTunnel(t packetswitch.NetworkLayerDevice)
SetTunnel sets the network layer tunnel device for the wrapped WireGuard device.
func (*WrappedWireguardDevice) SetupDeviceWithoutPeers ¶
func (w *WrappedWireguardDevice) SetupDeviceWithoutPeers() error
func (*WrappedWireguardDevice) Up ¶
func (w *WrappedWireguardDevice) Up() error