config

package
v0.3.1-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BypassMode_name = map[int32]string{
		0: "bypass",
		1: "direct",
		2: "proxy",
		3: "block",
	}
	BypassMode_value = map[string]int32{
		"bypass": 0,
		"direct": 1,
		"proxy":  2,
		"block":  3,
	}
)

Enum value maps for BypassMode.

View Source
var (
	DnsDnsType_name = map[int32]string{
		0: "reserve",
		1: "udp",
		2: "tcp",
		3: "doh",
		4: "dot",
		5: "doq",
		6: "doh3",
	}
	DnsDnsType_value = map[string]int32{
		"reserve": 0,
		"udp":     1,
		"tcp":     2,
		"doh":     3,
		"dot":     4,
		"doq":     5,
		"doh3":    6,
	}
)

Enum value maps for DnsDnsType.

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

Enum value maps for TunEndpointDriver.

View Source
var File_config_config_proto protoreflect.FileDescriptor

Functions

func CreateServer

func CreateServer(p isServerProtocol_Protocol, opts ...func(*Opts)) (server.Server, error)

func DefaultConfigDir

func DefaultConfigDir() (Path string)

func RegisterProtocol

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

func WithDNSServer

func WithDNSServer(s server.DNSServer) func(*Opts)

func WithDialer

func WithDialer(p proxy.Proxy) func(*Opts)

func WithUidDumper

func WithUidDumper(d UidDumper) func(*Opts)

Types

type Bypass

type Bypass struct {
	Tcp        BypassMode `protobuf:"varint,3,opt,name=tcp,proto3,enum=yuhaiin.config.BypassMode" json:"tcp,omitempty"`
	Udp        BypassMode `protobuf:"varint,4,opt,name=udp,proto3,enum=yuhaiin.config.BypassMode" json:"udp,omitempty"`
	BypassFile string     `protobuf:"bytes,2,opt,name=bypass_file,proto3" json:"bypass_file,omitempty"`
	// contains filtered or unexported fields
}

func (*Bypass) Descriptor deprecated

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

Deprecated: Use Bypass.ProtoReflect.Descriptor instead.

func (*Bypass) GetBypassFile

func (x *Bypass) GetBypassFile() string

func (*Bypass) GetTcp

func (x *Bypass) GetTcp() BypassMode

func (*Bypass) GetUdp

func (x *Bypass) GetUdp() BypassMode

func (*Bypass) ProtoMessage

func (*Bypass) ProtoMessage()

func (*Bypass) ProtoReflect

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

func (*Bypass) Reset

func (x *Bypass) Reset()

func (*Bypass) String

func (x *Bypass) String() string

type BypassMode

type BypassMode int32
const (
	Bypass_bypass BypassMode = 0
	Bypass_direct BypassMode = 1
	Bypass_proxy  BypassMode = 2
	Bypass_block  BypassMode = 3
)

func (BypassMode) Descriptor

func (BypassMode) Descriptor() protoreflect.EnumDescriptor

func (BypassMode) Enum

func (x BypassMode) Enum() *BypassMode

func (BypassMode) EnumDescriptor deprecated

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

Deprecated: Use BypassMode.Descriptor instead.

func (BypassMode) Number

func (x BypassMode) Number() protoreflect.EnumNumber

func (BypassMode) String

func (x BypassMode) String() string

func (BypassMode) Type

type Dns

type Dns struct {
	Host          string     `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Type          DnsDnsType `protobuf:"varint,5,opt,name=type,proto3,enum=yuhaiin.config.DnsDnsType" json:"type,omitempty"`
	Proxy         bool       `protobuf:"varint,3,opt,name=proxy,proto3" json:"proxy,omitempty"`
	Subnet        string     `protobuf:"bytes,4,opt,name=subnet,proto3" json:"subnet,omitempty"`
	TlsServername string     `protobuf:"bytes,2,opt,name=tls_servername,proto3" json:"tls_servername,omitempty"`
	// contains filtered or unexported fields
}

func (*Dns) Descriptor deprecated

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

Deprecated: Use Dns.ProtoReflect.Descriptor instead.

func (*Dns) GetHost

func (x *Dns) GetHost() string

func (*Dns) GetProxy

func (x *Dns) GetProxy() bool

func (*Dns) GetSubnet

func (x *Dns) GetSubnet() string

func (*Dns) GetTlsServername

func (x *Dns) GetTlsServername() string

func (*Dns) GetType

func (x *Dns) GetType() DnsDnsType

func (*Dns) ProtoMessage

func (*Dns) ProtoMessage()

func (*Dns) ProtoReflect

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

func (*Dns) Reset

func (x *Dns) Reset()

func (*Dns) String

func (x *Dns) String() string

type DnsDnsType

type DnsDnsType int32
const (
	Dns_reserve DnsDnsType = 0
	Dns_udp     DnsDnsType = 1
	Dns_tcp     DnsDnsType = 2
	Dns_doh     DnsDnsType = 3
	Dns_dot     DnsDnsType = 4
	Dns_doq     DnsDnsType = 5
	Dns_doh3    DnsDnsType = 6
)

func (DnsDnsType) Descriptor

func (DnsDnsType) Descriptor() protoreflect.EnumDescriptor

func (DnsDnsType) Enum

func (x DnsDnsType) Enum() *DnsDnsType

func (DnsDnsType) EnumDescriptor deprecated

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

Deprecated: Use DnsDnsType.Descriptor instead.

func (DnsDnsType) Number

func (x DnsDnsType) Number() protoreflect.EnumNumber

func (DnsDnsType) String

func (x DnsDnsType) String() string

func (DnsDnsType) Type

type DnsSetting

type DnsSetting struct {
	Server         string `protobuf:"bytes,4,opt,name=server,proto3" json:"server,omitempty"`
	Fakedns        bool   `protobuf:"varint,5,opt,name=fakedns,proto3" json:"fakedns,omitempty"`
	FakednsIpRange string `protobuf:"bytes,6,opt,name=fakedns_ip_range,proto3" json:"fakedns_ip_range,omitempty"`
	Remote         *Dns   `protobuf:"bytes,1,opt,name=remote,proto3" json:"remote,omitempty"`
	Local          *Dns   `protobuf:"bytes,2,opt,name=local,proto3" json:"local,omitempty"`
	Bootstrap      *Dns   `protobuf:"bytes,3,opt,name=bootstrap,proto3" json:"bootstrap,omitempty"`
	// contains filtered or unexported fields
}

func (*DnsSetting) Descriptor deprecated

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

Deprecated: Use DnsSetting.ProtoReflect.Descriptor instead.

func (*DnsSetting) GetBootstrap

func (x *DnsSetting) GetBootstrap() *Dns

func (*DnsSetting) GetFakedns

func (x *DnsSetting) GetFakedns() bool

func (*DnsSetting) GetFakednsIpRange

func (x *DnsSetting) GetFakednsIpRange() string

func (*DnsSetting) GetLocal

func (x *DnsSetting) GetLocal() *Dns

func (*DnsSetting) GetRemote

func (x *DnsSetting) GetRemote() *Dns

func (*DnsSetting) GetServer

func (x *DnsSetting) GetServer() string

func (*DnsSetting) ProtoMessage

func (*DnsSetting) ProtoMessage()

func (*DnsSetting) ProtoReflect

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

func (*DnsSetting) Reset

func (x *DnsSetting) Reset()

func (*DnsSetting) String

func (x *DnsSetting) 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"`
	Enabled  bool   `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// contains filtered or unexported fields
}

func (*Http) Descriptor deprecated

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

Deprecated: Use Http.ProtoReflect.Descriptor instead.

func (*Http) GetEnabled

func (x *Http) GetEnabled() bool

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 Opts

type Opts struct {
	Dialer    proxy.Proxy
	DNSServer server.DNSServer
	UidDumper UidDumper
}

type Redir

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

func (*Redir) Descriptor deprecated

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

Deprecated: Use Redir.ProtoReflect.Descriptor instead.

func (*Redir) GetEnabled

func (x *Redir) GetEnabled() bool

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 Server

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

func (*Server) Descriptor deprecated

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

Deprecated: Use Server.ProtoReflect.Descriptor instead.

func (*Server) GetServers

func (x *Server) GetServers() map[string]*ServerProtocol

func (*Server) ProtoMessage

func (*Server) ProtoMessage()

func (*Server) ProtoReflect

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

func (*Server) Reset

func (x *Server) Reset()

func (*Server) String

func (x *Server) String() string

type ServerProtocol

type ServerProtocol struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Types that are assignable to Protocol:
	//	*ServerProtocol_Http
	//	*ServerProtocol_Socks5
	//	*ServerProtocol_Redir
	//	*ServerProtocol_Tun
	Protocol isServerProtocol_Protocol `protobuf_oneof:"protocol"`
	// contains filtered or unexported fields
}

func (*ServerProtocol) Descriptor deprecated

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

Deprecated: Use ServerProtocol.ProtoReflect.Descriptor instead.

func (*ServerProtocol) GetHttp

func (x *ServerProtocol) GetHttp() *Http

func (*ServerProtocol) GetName

func (x *ServerProtocol) GetName() string

func (*ServerProtocol) GetProtocol

func (m *ServerProtocol) GetProtocol() isServerProtocol_Protocol

func (*ServerProtocol) GetRedir

func (x *ServerProtocol) GetRedir() *Redir

func (*ServerProtocol) GetSocks5

func (x *ServerProtocol) GetSocks5() *Socks5

func (*ServerProtocol) GetTun

func (x *ServerProtocol) GetTun() *Tun

func (*ServerProtocol) ProtoMessage

func (*ServerProtocol) ProtoMessage()

func (*ServerProtocol) ProtoReflect

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

func (*ServerProtocol) Reset

func (x *ServerProtocol) Reset()

func (*ServerProtocol) String

func (x *ServerProtocol) String() string

type ServerProtocol_Http

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

type ServerProtocol_Redir

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

type ServerProtocol_Socks5

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

type ServerProtocol_Tun

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

type Setting

type Setting struct {

	// net interface, eg: eth0
	NetInterface string       `protobuf:"bytes,6,opt,name=net_interface,proto3" json:"net_interface,omitempty"`
	SystemProxy  *SystemProxy `protobuf:"bytes,1,opt,name=system_proxy,proto3" json:"system_proxy,omitempty"`
	Bypass       *Bypass      `protobuf:"bytes,2,opt,name=bypass,proto3" json:"bypass,omitempty"`
	Dns          *DnsSetting  `protobuf:"bytes,4,opt,name=dns,proto3" json:"dns,omitempty"`
	Server       *Server      `protobuf:"bytes,5,opt,name=server,proto3" json:"server,omitempty"`
	// contains filtered or unexported fields
}

func (*Setting) Descriptor deprecated

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

Deprecated: Use Setting.ProtoReflect.Descriptor instead.

func (*Setting) GetBypass

func (x *Setting) GetBypass() *Bypass

func (*Setting) GetDns

func (x *Setting) GetDns() *DnsSetting

func (*Setting) GetNetInterface

func (x *Setting) GetNetInterface() string

func (*Setting) GetServer

func (x *Setting) GetServer() *Server

func (*Setting) GetSystemProxy

func (x *Setting) GetSystemProxy() *SystemProxy

func (*Setting) ProtoMessage

func (*Setting) ProtoMessage()

func (*Setting) ProtoReflect

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

func (*Setting) Reset

func (x *Setting) Reset()

func (*Setting) String

func (x *Setting) String() string

type Socks5

type Socks5 struct {
	Host     string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Enabled  bool   `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,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) GetEnabled

func (x *Socks5) GetEnabled() bool

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 SystemProxy

type SystemProxy struct {
	Http   bool `protobuf:"varint,2,opt,name=http,proto3" json:"http,omitempty"`
	Socks5 bool `protobuf:"varint,3,opt,name=socks5,proto3" json:"socks5,omitempty"`
	// contains filtered or unexported fields
}

func (*SystemProxy) Descriptor deprecated

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

Deprecated: Use SystemProxy.ProtoReflect.Descriptor instead.

func (*SystemProxy) GetHttp

func (x *SystemProxy) GetHttp() bool

func (*SystemProxy) GetSocks5

func (x *SystemProxy) GetSocks5() bool

func (*SystemProxy) ProtoMessage

func (*SystemProxy) ProtoMessage()

func (*SystemProxy) ProtoReflect

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

func (*SystemProxy) Reset

func (x *SystemProxy) Reset()

func (*SystemProxy) String

func (x *SystemProxy) 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"`
	Enabled       bool              `protobuf:"varint,5,opt,name=enabled,proto3" json:"enabled,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.config.TunEndpointDriver" json:"driver,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) GetEnabled

func (x *Tun) GetEnabled() bool

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) 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
)

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 UidDumper

type UidDumper interface {
	DumpUid(ipProto int32, srcIp string, srcPort int32, destIp string, destPort int32) (int32, error)
	GetUidInfo(uid int32) (string, error)
}

Jump to

Keyboard shortcuts

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