config

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCertFile = "cert.pem"
	DefaultKeyFile  = "key.pem"
)
View Source
var (
	Routers []Router
)

Functions

func LoadCA

func LoadCA(caFile string) (cp *x509.CertPool, err error)

func ParseAuthenticator

func ParseAuthenticator(s string) (gost.Authenticator, error)

func ParseBypass

func ParseBypass(s string) *gost.Bypass

func ParseChainNode

func ParseChainNode(ns string) (nodes []gost.Node, err error)

func ParseHosts

func ParseHosts(s string) *gost.Hosts

func ParseIP

func ParseIP(s string, port string) (ips []string)

func ParseResolver

func ParseResolver(cfg string) gost.Resolver

func ParseUsers

func ParseUsers(authFile string) (users []*url.Userinfo, err error)

func TlsConfig

func TlsConfig(certFile, keyFile string) (*tls.Config, error)

Load the certificate from cert and key files, will use the default certificate if the provided info are invalid.

Types

type BaseConfig

type BaseConfig struct {
	Route
	Routes []Route
	Debug  bool
}

func ParseBaseConfig

func ParseBaseConfig(s string, baseCfg *BaseConfig) (*BaseConfig, error)

type PeerConfig

type PeerConfig struct {
	Strategy    string `json:"strategy"`
	MaxFails    int    `json:"max_fails"`
	FailTimeout time.Duration
	PeriodF     time.Duration // the PeriodF for live reloading
	Nodes       []string      `json:"nodes"`
	Group       *gost.NodeGroup
	BaseNodes   []gost.Node
	StoppedF    chan struct{}
}

func (*PeerConfig) Period

func (cfg *PeerConfig) Period() time.Duration

func (*PeerConfig) Reload

func (cfg *PeerConfig) Reload(r io.Reader) error

func (*PeerConfig) Stop

func (cfg *PeerConfig) Stop()

Stop stops reloading.

func (*PeerConfig) Stopped

func (cfg *PeerConfig) Stopped() bool

Stopped checks whether the reloader is StoppedF.

func (*PeerConfig) Validate

func (cfg *PeerConfig) Validate()

type Route

type Route struct {
	ServeNodes StringList
	ChainNodes StringList
	Retries    int
}

func (*Route) GenRouters

func (r *Route) GenRouters() ([]Router, error)

func (*Route) ParseChain

func (r *Route) ParseChain() (*gost.Chain, error)

type Router

type Router struct {
	Node     gost.Node
	Server   *gost.Server
	Handler  gost.Handler
	Chain    *gost.Chain
	Resolver gost.Resolver
	Hosts    *gost.Hosts
}

func (*Router) Close

func (r *Router) Close() error

func (*Router) Serve

func (r *Router) Serve() error

type StringList

type StringList []string

func (*StringList) Set

func (l *StringList) Set(value string) error

func (*StringList) String

func (l *StringList) String() string

Jump to

Keyboard shortcuts

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