wireguard

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MPL-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DeviceConfig_DomainStrategy_name = map[int32]string{
		0: "FORCE_IP",
		1: "FORCE_IP4",
		2: "FORCE_IP6",
		3: "FORCE_IP46",
		4: "FORCE_IP64",
	}
	DeviceConfig_DomainStrategy_value = map[string]int32{
		"FORCE_IP":   0,
		"FORCE_IP4":  1,
		"FORCE_IP6":  2,
		"FORCE_IP46": 3,
		"FORCE_IP64": 4,
	}
)

Enum value maps for DeviceConfig_DomainStrategy.

View Source
var File_proxy_wireguard_config_proto protoreflect.FileDescriptor

Functions

func CalculateInterfaceName

func CalculateInterfaceName(name string) (tunName string)

func KernelTunSupported

func KernelTunSupported() 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"`
	DomainStrategy DeviceConfig_DomainStrategy `` /* 158-byte string literal not displayed */
	IsClient       bool                        `protobuf:"varint,8,opt,name=is_client,json=isClient,proto3" json:"is_client,omitempty"`
	KernelMode     bool                        `protobuf:"varint,9,opt,name=kernel_mode,json=kernelMode,proto3" json:"kernel_mode,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceConfig) Descriptor deprecated

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

Deprecated: Use DeviceConfig.ProtoReflect.Descriptor instead.

func (*DeviceConfig) GetDomainStrategy

func (x *DeviceConfig) GetDomainStrategy() DeviceConfig_DomainStrategy

func (*DeviceConfig) GetEndpoint

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

func (*DeviceConfig) GetIsClient

func (x *DeviceConfig) GetIsClient() bool

func (*DeviceConfig) GetKernelMode

func (x *DeviceConfig) GetKernelMode() bool

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 DeviceConfig_DomainStrategy

type DeviceConfig_DomainStrategy int32
const (
	DeviceConfig_FORCE_IP   DeviceConfig_DomainStrategy = 0
	DeviceConfig_FORCE_IP4  DeviceConfig_DomainStrategy = 1
	DeviceConfig_FORCE_IP6  DeviceConfig_DomainStrategy = 2
	DeviceConfig_FORCE_IP46 DeviceConfig_DomainStrategy = 3
	DeviceConfig_FORCE_IP64 DeviceConfig_DomainStrategy = 4
)

func (DeviceConfig_DomainStrategy) Descriptor

func (DeviceConfig_DomainStrategy) Enum

func (DeviceConfig_DomainStrategy) EnumDescriptor deprecated

func (DeviceConfig_DomainStrategy) EnumDescriptor() ([]byte, []int)

Deprecated: Use DeviceConfig_DomainStrategy.Descriptor instead.

func (DeviceConfig_DomainStrategy) Number

func (DeviceConfig_DomainStrategy) String

func (DeviceConfig_DomainStrategy) Type

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 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    uint32   `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() uint32

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

type Server

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

func NewServer

func NewServer(ctx context.Context, conf *DeviceConfig) (*Server, error)

func (*Server) Network

func (*Server) Network() []net.Network

Network implements proxy.Inbound.

func (*Server) Process

func (s *Server) Process(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher) error

Process implements proxy.Inbound.

type Tunnel

type Tunnel interface {
	BuildDevice(ipc string, bind conn.Bind) error
	DialContextTCPAddrPort(ctx context.Context, addr netip.AddrPort) (net.Conn, error)
	DialUDPAddrPort(laddr, raddr netip.AddrPort) (net.Conn, error)
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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