config

package
v1.21.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvYeagerAddress   = "YEAGER_ADDRESS"
	EnvYeagerTransport = "YEAGER_TRANSPORT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Inbounds  Inbounds        `json:"inbounds,omitempty"`  // 入站代理
	Outbounds []*YeagerClient `json:"outbounds,omitempty"` // 出站代理
	Rules     []string        `json:"rules,omitempty"`     // 路由规则
	Verbose   bool            `json:"verbose,omitempty"`   // verbose log

	// developer only
	Debug bool `json:"debug,omitempty"`
	// 如何预估连接池大小,参考 proxy/yeager/transport/grpc/pool.go
	GrpcChannelPoolSize int `json:"grpcChannelPoolSize,omitempty"`
}

func C added in v1.20.0

func C() Config

func LoadEnv

func LoadEnv() (conf *Config, err error)

Deprecated LoadEnv generate configuration from environment variables, suitable for server side plaintext

func LoadFile

func LoadFile(filename string) (*Config, error)

LoadFile load config from JSON file

func LoadJSON

func LoadJSON(bs []byte) (*Config, error)

LoadJSON load config from bytes in JSON format

type Inbounds

type Inbounds struct {
	SOCKS *struct {
		Listen string `json:"listen"`
	} `json:"socks,omitempty"`

	HTTP *struct {
		Listen string `json:"listen"`
	} `json:"http,omitempty"`

	Yeager *YeagerServer `json:"yeager,omitempty"`
}

type MutualTLS added in v1.20.7

type MutualTLS struct {
	CertFile string `json:"certFile"`
	CertPEM  []byte `json:"-"`
	KeyFile  string `json:"keyFile"`
	KeyPEM   []byte `json:"-"`
	CAFile   string `json:"caFile"`
	CAPEM    []byte `json:"-"`
}

type Transport

type Transport string
const (
	TransTCP  Transport = "tcp" // plain text
	TransGRPC Transport = "grpc"
	TransQUIC Transport = "quic"
)

type YeagerClient

type YeagerClient struct {
	Tag       string    `json:"tag"`     // 出站标记,用于路由规则指定出站代理
	Address   string    `json:"address"` // server address to be connected
	Transport Transport `json:"transport"`
	MutualTLS MutualTLS `json:"mtls,omitempty"` // unavailable when transport is tcp
}

type YeagerServer

type YeagerServer struct {
	Listen    string    `json:"listen"`
	Transport Transport `json:"transport"`
	MutualTLS MutualTLS `json:"mtls,omitempty"` // unavailable when transport is tcp
}

Jump to

Keyboard shortcuts

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