listener

package
v0.3.1-rc.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TunEndpointDriver_name = map[int32]string{
		0: "fdbased",
		1: "channel",
		2: "system_gvisor",
	}
	TunEndpointDriver_value = map[string]int32{
		"fdbased":       0,
		"channel":       1,
		"system_gvisor": 2,
	}
)

Enum value maps for TunEndpointDriver.

View Source
var File_config_listener_listener_proto protoreflect.FileDescriptor

Functions

func CreateServer

func CreateServer(opts *Opts[IsProtocol_Protocol]) (server.Server, error)

func ParseTLS

func ParseTLS(t *TlsConfig) (*tls.Config, error)

func RegisterProtocol

func RegisterProtocol[T isProtocol_Protocol](wrap func(*Opts[T]) (server.Server, error))

Types

type Certificate

type Certificate struct {
	Cert []byte `protobuf:"bytes,1,opt,name=cert,proto3" json:"cert,omitempty"`
	Key  []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*Certificate) Descriptor deprecated

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

Deprecated: Use Certificate.ProtoReflect.Descriptor instead.

func (*Certificate) GetCert

func (x *Certificate) GetCert() []byte

func (*Certificate) GetKey

func (x *Certificate) GetKey() []byte

func (*Certificate) ProtoMessage

func (*Certificate) ProtoMessage()

func (*Certificate) ProtoReflect

func (x *Certificate) ProtoReflect() protoreflect.Message

func (*Certificate) Reset

func (x *Certificate) Reset()

func (*Certificate) String

func (x *Certificate) String() string

type Config

type Config struct {
	Servers map[string]*Protocol `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetServers

func (x *Config) GetServers() map[string]*Protocol

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type Grpc

type Grpc struct {
	Tls *TlsConfig `protobuf:"bytes,1,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

func (*Grpc) Descriptor deprecated

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

Deprecated: Use Grpc.ProtoReflect.Descriptor instead.

func (*Grpc) GetTls

func (x *Grpc) GetTls() *TlsConfig

func (*Grpc) ProtoMessage

func (*Grpc) ProtoMessage()

func (*Grpc) ProtoReflect

func (x *Grpc) ProtoReflect() protoreflect.Message

func (*Grpc) Reset

func (x *Grpc) Reset()

func (*Grpc) String

func (x *Grpc) String() string

type Http

type Http struct {
	Host     string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*Http) Descriptor deprecated

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

Deprecated: Use Http.ProtoReflect.Descriptor instead.

func (*Http) GetHost

func (x *Http) GetHost() string

func (*Http) GetPassword

func (x *Http) GetPassword() string

func (*Http) GetUsername

func (x *Http) GetUsername() string

func (*Http) ProtoMessage

func (*Http) ProtoMessage()

func (*Http) ProtoReflect

func (x *Http) ProtoReflect() protoreflect.Message

func (*Http) Reset

func (x *Http) Reset()

func (*Http) String

func (x *Http) String() string

type IsProtocol_Protocol

type IsProtocol_Protocol interface {
	// contains filtered or unexported methods
}

type Normal

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

func (*Normal) Descriptor deprecated

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

Deprecated: Use Normal.ProtoReflect.Descriptor instead.

func (*Normal) ProtoMessage

func (*Normal) ProtoMessage()

func (*Normal) ProtoReflect

func (x *Normal) ProtoReflect() protoreflect.Message

func (*Normal) Reset

func (x *Normal) Reset()

func (*Normal) String

func (x *Normal) String() string

type Opts

type Opts[T isProtocol_Protocol] struct {
	Dialer    proxy.Proxy
	DNSServer server.DNSServer
	IPv6      bool
	NatTable  *nat.Table

	Protocol T
}

func CovertOpts

func CovertOpts[T1, T2 isProtocol_Protocol](o *Opts[T1], f func(t T1) T2) *Opts[T2]

type ProcessDumper

type ProcessDumper interface {
	ProcessName(network string, src, dst proxy.Address) (string, error)
}

type Protocol

type Protocol struct {
	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Enabled bool   `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// Types that are assignable to Protocol:
	//
	//	*Protocol_Http
	//	*Protocol_Socks5
	//	*Protocol_Redir
	//	*Protocol_Tun
	//	*Protocol_Yuubinsya
	Protocol isProtocol_Protocol `protobuf_oneof:"protocol"`
	// contains filtered or unexported fields
}

func (*Protocol) Descriptor deprecated

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

Deprecated: Use Protocol.ProtoReflect.Descriptor instead.

func (*Protocol) GetEnabled

func (x *Protocol) GetEnabled() bool

func (*Protocol) GetHttp

func (x *Protocol) GetHttp() *Http

func (*Protocol) GetName

func (x *Protocol) GetName() string

func (*Protocol) GetProtocol

func (m *Protocol) GetProtocol() isProtocol_Protocol

func (*Protocol) GetRedir

func (x *Protocol) GetRedir() *Redir

func (*Protocol) GetSocks5

func (x *Protocol) GetSocks5() *Socks5

func (*Protocol) GetTun

func (x *Protocol) GetTun() *Tun

func (*Protocol) GetYuubinsya

func (x *Protocol) GetYuubinsya() *Yuubinsya

func (*Protocol) ProtoMessage

func (*Protocol) ProtoMessage()

func (*Protocol) ProtoReflect

func (x *Protocol) ProtoReflect() protoreflect.Message

func (*Protocol) Reset

func (x *Protocol) Reset()

func (*Protocol) String

func (x *Protocol) String() string

type Protocol_Http

type Protocol_Http struct {
	Http *Http `protobuf:"bytes,3,opt,name=http,proto3,oneof"`
}

type Protocol_Redir

type Protocol_Redir struct {
	Redir *Redir `protobuf:"bytes,5,opt,name=redir,proto3,oneof"`
}

type Protocol_Socks5

type Protocol_Socks5 struct {
	Socks5 *Socks5 `protobuf:"bytes,4,opt,name=socks5,proto3,oneof"`
}

type Protocol_Tun

type Protocol_Tun struct {
	Tun *Tun `protobuf:"bytes,6,opt,name=tun,proto3,oneof"`
}

type Protocol_Yuubinsya

type Protocol_Yuubinsya struct {
	Yuubinsya *Yuubinsya `protobuf:"bytes,7,opt,name=yuubinsya,proto3,oneof"`
}

type Quic

type Quic struct {
	Tls *TlsConfig `protobuf:"bytes,1,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

func (*Quic) Descriptor deprecated

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

Deprecated: Use Quic.ProtoReflect.Descriptor instead.

func (*Quic) GetTls

func (x *Quic) GetTls() *TlsConfig

func (*Quic) ProtoMessage

func (*Quic) ProtoMessage()

func (*Quic) ProtoReflect

func (x *Quic) ProtoReflect() protoreflect.Message

func (*Quic) Reset

func (x *Quic) Reset()

func (*Quic) String

func (x *Quic) String() string

type Redir

type Redir struct {
	Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	// contains filtered or unexported fields
}

func (*Redir) Descriptor deprecated

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

Deprecated: Use Redir.ProtoReflect.Descriptor instead.

func (*Redir) GetHost

func (x *Redir) GetHost() string

func (*Redir) ProtoMessage

func (*Redir) ProtoMessage()

func (*Redir) ProtoReflect

func (x *Redir) ProtoReflect() protoreflect.Message

func (*Redir) Reset

func (x *Redir) Reset()

func (*Redir) String

func (x *Redir) String() string

type Socks5

type Socks5 struct {
	Host     string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*Socks5) Descriptor deprecated

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

Deprecated: Use Socks5.ProtoReflect.Descriptor instead.

func (*Socks5) GetHost

func (x *Socks5) GetHost() string

func (*Socks5) GetPassword

func (x *Socks5) GetPassword() string

func (*Socks5) GetUsername

func (x *Socks5) GetUsername() string

func (*Socks5) ProtoMessage

func (*Socks5) ProtoMessage()

func (*Socks5) ProtoReflect

func (x *Socks5) ProtoReflect() protoreflect.Message

func (*Socks5) Reset

func (x *Socks5) Reset()

func (*Socks5) String

func (x *Socks5) String() string

type Tls

type Tls struct {
	Tls *TlsConfig `protobuf:"bytes,1,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

func (*Tls) Descriptor deprecated

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

Deprecated: Use Tls.ProtoReflect.Descriptor instead.

func (*Tls) GetTls

func (x *Tls) GetTls() *TlsConfig

func (*Tls) ProtoMessage

func (*Tls) ProtoMessage()

func (*Tls) ProtoReflect

func (x *Tls) ProtoReflect() protoreflect.Message

func (*Tls) Reset

func (x *Tls) Reset()

func (*Tls) String

func (x *Tls) String() string

type TlsConfig

type TlsConfig struct {
	Certificates          []*Certificate          `protobuf:"bytes,1,rep,name=certificates,proto3" json:"certificates,omitempty"`
	NextProtos            []string                `protobuf:"bytes,3,rep,name=next_protos,proto3" json:"next_protos,omitempty"`
	ServerNameCertificate map[string]*Certificate `` /* 187-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*TlsConfig) Descriptor deprecated

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

Deprecated: Use TlsConfig.ProtoReflect.Descriptor instead.

func (*TlsConfig) GetCertificates

func (x *TlsConfig) GetCertificates() []*Certificate

func (*TlsConfig) GetNextProtos

func (x *TlsConfig) GetNextProtos() []string

func (*TlsConfig) GetServerNameCertificate

func (x *TlsConfig) GetServerNameCertificate() map[string]*Certificate

func (*TlsConfig) ProtoMessage

func (*TlsConfig) ProtoMessage()

func (*TlsConfig) ProtoReflect

func (x *TlsConfig) ProtoReflect() protoreflect.Message

func (*TlsConfig) Reset

func (x *TlsConfig) Reset()

func (*TlsConfig) String

func (x *TlsConfig) String() string

type Tun

type Tun struct {

	// name of the tun device
	// eg: tun://tun0, fd://123
	Name          string            `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Mtu           int32             `protobuf:"varint,2,opt,name=mtu,proto3" json:"mtu,omitempty"`
	Gateway       string            `protobuf:"bytes,3,opt,name=gateway,proto3" json:"gateway,omitempty"`
	DnsHijacking  bool              `protobuf:"varint,4,opt,name=dns_hijacking,proto3" json:"dns_hijacking,omitempty"`
	SkipMulticast bool              `protobuf:"varint,6,opt,name=skip_multicast,proto3" json:"skip_multicast,omitempty"`
	Driver        TunEndpointDriver `protobuf:"varint,7,opt,name=driver,proto3,enum=yuhaiin.listener.TunEndpointDriver" json:"driver,omitempty"`
	Portal        string            `protobuf:"bytes,8,opt,name=portal,proto3" json:"portal,omitempty"`
	// contains filtered or unexported fields
}

func (*Tun) Descriptor deprecated

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

Deprecated: Use Tun.ProtoReflect.Descriptor instead.

func (*Tun) GetDnsHijacking

func (x *Tun) GetDnsHijacking() bool

func (*Tun) GetDriver

func (x *Tun) GetDriver() TunEndpointDriver

func (*Tun) GetGateway

func (x *Tun) GetGateway() string

func (*Tun) GetMtu

func (x *Tun) GetMtu() int32

func (*Tun) GetName

func (x *Tun) GetName() string

func (*Tun) GetPortal

func (x *Tun) GetPortal() string

func (*Tun) GetSkipMulticast

func (x *Tun) GetSkipMulticast() bool

func (*Tun) ProtoMessage

func (*Tun) ProtoMessage()

func (*Tun) ProtoReflect

func (x *Tun) ProtoReflect() protoreflect.Message

func (*Tun) Reset

func (x *Tun) Reset()

func (*Tun) String

func (x *Tun) String() string

type TunEndpointDriver

type TunEndpointDriver int32
const (
	Tun_fdbased       TunEndpointDriver = 0
	Tun_channel       TunEndpointDriver = 1
	Tun_system_gvisor TunEndpointDriver = 2
)

func (TunEndpointDriver) Descriptor

func (TunEndpointDriver) Enum

func (TunEndpointDriver) EnumDescriptor deprecated

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

Deprecated: Use TunEndpointDriver.Descriptor instead.

func (TunEndpointDriver) Number

func (TunEndpointDriver) String

func (x TunEndpointDriver) String() string

func (TunEndpointDriver) Type

type Websocket

type Websocket struct {
	Tls *TlsConfig `protobuf:"bytes,1,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

func (*Websocket) Descriptor deprecated

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

Deprecated: Use Websocket.ProtoReflect.Descriptor instead.

func (*Websocket) GetTls

func (x *Websocket) GetTls() *TlsConfig

func (*Websocket) ProtoMessage

func (*Websocket) ProtoMessage()

func (*Websocket) ProtoReflect

func (x *Websocket) ProtoReflect() protoreflect.Message

func (*Websocket) Reset

func (x *Websocket) Reset()

func (*Websocket) String

func (x *Websocket) String() string

type Yuubinsya

type Yuubinsya struct {
	Host                string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Password            string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	ForceDisableEncrypt bool   `protobuf:"varint,8,opt,name=force_disable_encrypt,proto3" json:"force_disable_encrypt,omitempty"`
	// Types that are assignable to Protocol:
	//
	//	*Yuubinsya_Normal
	//	*Yuubinsya_Tls
	//	*Yuubinsya_Quic
	//	*Yuubinsya_Websocket
	//	*Yuubinsya_Grpc
	Protocol isYuubinsya_Protocol `protobuf_oneof:"protocol"`
	// contains filtered or unexported fields
}

func (*Yuubinsya) Descriptor deprecated

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

Deprecated: Use Yuubinsya.ProtoReflect.Descriptor instead.

func (*Yuubinsya) GetForceDisableEncrypt

func (x *Yuubinsya) GetForceDisableEncrypt() bool

func (*Yuubinsya) GetGrpc

func (x *Yuubinsya) GetGrpc() *Grpc

func (*Yuubinsya) GetHost

func (x *Yuubinsya) GetHost() string

func (*Yuubinsya) GetNormal

func (x *Yuubinsya) GetNormal() *Normal

func (*Yuubinsya) GetPassword

func (x *Yuubinsya) GetPassword() string

func (*Yuubinsya) GetProtocol

func (m *Yuubinsya) GetProtocol() isYuubinsya_Protocol

func (*Yuubinsya) GetQuic

func (x *Yuubinsya) GetQuic() *Quic

func (*Yuubinsya) GetTls

func (x *Yuubinsya) GetTls() *Tls

func (*Yuubinsya) GetWebsocket

func (x *Yuubinsya) GetWebsocket() *Websocket

func (*Yuubinsya) ProtoMessage

func (*Yuubinsya) ProtoMessage()

func (*Yuubinsya) ProtoReflect

func (x *Yuubinsya) ProtoReflect() protoreflect.Message

func (*Yuubinsya) Reset

func (x *Yuubinsya) Reset()

func (*Yuubinsya) String

func (x *Yuubinsya) String() string

type YuubinsyaProtocolNormal

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

func (*YuubinsyaProtocolNormal) Descriptor deprecated

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

Deprecated: Use YuubinsyaProtocolNormal.ProtoReflect.Descriptor instead.

func (*YuubinsyaProtocolNormal) ProtoMessage

func (*YuubinsyaProtocolNormal) ProtoMessage()

func (*YuubinsyaProtocolNormal) ProtoReflect

func (x *YuubinsyaProtocolNormal) ProtoReflect() protoreflect.Message

func (*YuubinsyaProtocolNormal) Reset

func (x *YuubinsyaProtocolNormal) Reset()

func (*YuubinsyaProtocolNormal) String

func (x *YuubinsyaProtocolNormal) String() string

type Yuubinsya_Grpc

type Yuubinsya_Grpc struct {
	Grpc *Grpc `protobuf:"bytes,7,opt,name=grpc,proto3,oneof"`
}

type Yuubinsya_Normal

type Yuubinsya_Normal struct {
	Normal *Normal `protobuf:"bytes,3,opt,name=normal,proto3,oneof"`
}

type Yuubinsya_Quic

type Yuubinsya_Quic struct {
	Quic *Quic `protobuf:"bytes,5,opt,name=quic,proto3,oneof"`
}

type Yuubinsya_Tls

type Yuubinsya_Tls struct {
	Tls *Tls `protobuf:"bytes,4,opt,name=tls,proto3,oneof"`
}

type Yuubinsya_Websocket

type Yuubinsya_Websocket struct {
	Websocket *Websocket `protobuf:"bytes,6,opt,name=websocket,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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