wireguard

package
v0.0.0-...-3a6f846 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MPL-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proxy_wireguard_config_proto protoreflect.FileDescriptor

Functions

func IsDomainName

func IsDomainName(s string) bool

Types

type DeviceConfig

type DeviceConfig struct {
	SecretKey  string        `protobuf:"bytes,1,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
	Endpoint   []string      `protobuf:"bytes,2,rep,name=endpoint,proto3" json:"endpoint,omitempty"`
	Peers      []*PeerConfig `protobuf:"bytes,3,rep,name=peers,proto3" json:"peers,omitempty"`
	Mtu        int32         `protobuf:"varint,4,opt,name=mtu,proto3" json:"mtu,omitempty"`
	NumWorkers int32         `protobuf:"varint,5,opt,name=num_workers,json=numWorkers,proto3" json:"num_workers,omitempty"`
	Reserved   []byte        `protobuf:"bytes,6,opt,name=reserved,proto3" json:"reserved,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceConfig) Descriptor deprecated

func (*DeviceConfig) Descriptor() ([]byte, []int)

Deprecated: Use DeviceConfig.ProtoReflect.Descriptor instead.

func (*DeviceConfig) GetEndpoint

func (x *DeviceConfig) GetEndpoint() []string

func (*DeviceConfig) GetMtu

func (x *DeviceConfig) GetMtu() int32

func (*DeviceConfig) GetNumWorkers

func (x *DeviceConfig) GetNumWorkers() int32

func (*DeviceConfig) GetPeers

func (x *DeviceConfig) GetPeers() []*PeerConfig

func (*DeviceConfig) GetReserved

func (x *DeviceConfig) GetReserved() []byte

func (*DeviceConfig) GetSecretKey

func (x *DeviceConfig) GetSecretKey() string

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 Handler

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

Handler is an outbound connection that silently swallow the entire payload.

func New

func New(ctx context.Context, conf *DeviceConfig) (*Handler, error)

New creates a new wireguard handler.

func (*Handler) Process

func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer internet.Dialer) error

Process implements OutboundHandler.Dispatch().

type Net

type Net netTun

func CreateNetTUN

func CreateNetTUN(localAddresses []netip.Addr, dnsClient dns.Client, mtu int) (tun.Device, *Net, error)

func (*Net) DialContextTCP

func (net *Net) DialContextTCP(ctx context.Context, addr *net.TCPAddr) (*gonet.TCPConn, error)

func (*Net) DialContextTCPAddrPort

func (net *Net) DialContextTCPAddrPort(ctx context.Context, addr netip.AddrPort) (*gonet.TCPConn, error)

func (*Net) DialTCP

func (net *Net) DialTCP(addr *net.TCPAddr) (*gonet.TCPConn, error)

func (*Net) DialTCPAddrPort

func (net *Net) DialTCPAddrPort(addr netip.AddrPort) (*gonet.TCPConn, error)

func (*Net) DialUDP

func (net *Net) DialUDP(laddr, raddr *net.UDPAddr) (*gonet.UDPConn, error)

func (*Net) DialUDPAddrPort

func (net *Net) DialUDPAddrPort(laddr, raddr netip.AddrPort) (*gonet.UDPConn, error)

func (*Net) HasV4

func (n *Net) HasV4() bool

func (*Net) HasV6

func (n *Net) HasV6() bool

func (*Net) ListenTCP

func (net *Net) ListenTCP(addr *net.TCPAddr) (*gonet.TCPListener, error)

func (*Net) ListenTCPAddrPort

func (net *Net) ListenTCPAddrPort(addr netip.AddrPort) (*gonet.TCPListener, error)

func (*Net) ListenUDP

func (net *Net) ListenUDP(laddr *net.UDPAddr) (*gonet.UDPConn, error)

func (*Net) ListenUDPAddrPort

func (net *Net) ListenUDPAddrPort(laddr netip.AddrPort) (*gonet.UDPConn, error)

type PeerConfig

type PeerConfig struct {
	PublicKey    string   `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	PreSharedKey string   `protobuf:"bytes,2,opt,name=pre_shared_key,json=preSharedKey,proto3" json:"pre_shared_key,omitempty"`
	Endpoint     string   `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	KeepAlive    int32    `protobuf:"varint,4,opt,name=keep_alive,json=keepAlive,proto3" json:"keep_alive,omitempty"`
	AllowedIps   []string `protobuf:"bytes,5,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
	// 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) GetKeepAlive

func (x *PeerConfig) GetKeepAlive() int32

func (*PeerConfig) GetPreSharedKey

func (x *PeerConfig) GetPreSharedKey() string

func (*PeerConfig) GetPublicKey

func (x *PeerConfig) GetPublicKey() string

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

Jump to

Keyboard shortcuts

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