config

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtoHTTP   = "http"
	ProtoSOCKS5 = "socks5"

	ProtoGRPC        = "grpc"
	ProtoHTTP2       = "h2"
	ProtoShadowsocks = "ss"
)

Variables

This section is empty.

Functions

func MutualTLS added in v1.20.7

func MutualTLS(host string) (clientTLS, serverTLS *tls.Config, err error)

MutualTLS returns a pair of client and server TLS config for mutual authentication

Types

type Config

type Config struct {
	Listen    []ServerConfig `json:"listen,omitempty"`    // supports http, socks5, grpc and h2 protocols
	Transport []ServerConfig `json:"transport,omitempty"` // supports grpc, h2 and shadowsocks protocols

	// NoProxy specifies a string that contains comma-separated values
	// specifying hosts that should be excluded from proxying. Each value is
	// represented by an IP address (1.2.3.4), an IP address in
	// CIDR notation (1.2.3.4/8), a domain name, or a special DNS label (*).
	// A domain name matches that name and all subdomains.
	// A single asterisk (*) indicates that no proxying should be done.
	// A best effort is made to parse the string and errors are ignored.
	NoProxy string `json:"no_proxy,omitempty"`
}

func Generate added in v1.26.3

func Generate(host string) (cli, srv Config, err error)

Generate returns a pair of client and server configuration for the given host

type ServerConfig added in v1.35.0

type ServerConfig struct {
	Protocol string `json:"protocol,omitempty"`
	Address  string `json:"address,omitempty"`

	// for TLS
	CertPEM []string `json:"cert_pem,omitempty"`
	KeyPEM  []string `json:"key_pem,omitempty"`
	CAPEM   []string `json:"ca_pem,omitempty"`

	// for h2
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`

	// for shadowsocks
	Cipher string `json:"cipher,omitempty"`
	Secret string `json:"secret,omitempty"`
}

func (ServerConfig) ClientTLS added in v1.35.0

func (s ServerConfig) ClientTLS() (*tls.Config, error)

func (ServerConfig) ServerTLS added in v1.35.0

func (s ServerConfig) ServerTLS() (*tls.Config, error)

Jump to

Keyboard shortcuts

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