Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoDialAddress = errors.New("no dial address is configured") ErrDialInProgress = errors.New("another dial is in progress") )
View Source
var ( Version = "dev" Homepage = "https://github.com/hexian000/tlswrapper" )
View Source
var DefaultConfig = Config{ ServerName: "example.com", NoDelay: true, Redial: true, KeepAlive: 25, ServerKeepAlive: 300, StartupLimitStart: 10, StartupLimitRate: 30, StartupLimitFull: 60, MaxConn: 16384, MaxSessions: 128, AcceptBacklog: 256, StreamWindow: 256 * 1024, ConnectTimeout: 15, StreamOpenTimeout: 30, StreamCloseTimeout: 120, WriteTimeout: 15, Log: "stdout", LogLevel: slog.LevelNotice, }
Functions ¶
Types ¶
type Config ¶
type Config struct { // (optional) default local identity Identity string `json:"identity,omitempty"` // tunnel configs Tunnels []TunnelConfig `json:"tunnel"` // (optional) keep tunnels connected Redial bool `json:"redial"` // (optional) health check and metrics, default to "" (disabled) HTTPListen string `json:"httplisten,omitempty"` // TLS: (optional) SNI field in handshake, default to "example.com" ServerName string `json:"sni"` // TLS: local certificate Certificate string `json:"cert"` // TLS: local private key PrivateKey string `json:"key"` // TLS: authorized remote certificates, bundle supported AuthorizedCerts []string `json:"authcerts"` // (optional) TCP no delay, default to true NoDelay bool `json:"nodelay"` // (optional) client-side keep alive interval in seconds, default to 25 (every 25s) KeepAlive int `json:"keepalive"` // (optional) server-side keep alive interval in seconds, default to 300 (every 5min) ServerKeepAlive int `json:"serverkeepalive"` // (optional) soft limit of concurrent unauthenticated connections, default to 10 StartupLimitStart int `json:"startuplimitstart"` // (optional) probability of random disconnection when soft limit is exceeded, default to 30 (30%) StartupLimitRate int `json:"startuplimitrate"` // (optional) hard limit of concurrent unauthenticated connections, default to 60 StartupLimitFull int `json:"startuplimitfull"` // (optional) max concurrent streams, default to 16384 MaxConn int `json:"maxconn"` // (optional) max concurrent incoming sessions, default to 128 MaxSessions int `json:"maxsessions"` // (optional) mux accept backlog, default to 256, you may not want to change this AcceptBacklog int `json:"backlog"` // (optional) stream window size in bytes, default to 256 KiB, increase this on long fat networks StreamWindow uint32 `json:"window"` // (optional) tunnel connecting timeout in seconds, default to 15 ConnectTimeout int `json:"timeout"` // (optional) stream open timeout in seconds, default to 30 StreamOpenTimeout int `json:"streamopentimeout"` // (optional) stream close timeout in seconds, default to 120 StreamCloseTimeout int `json:"streamclosetimeout"` // (optional) data write request timeout in seconds, default to 15, used to detect network failes early WriteTimeout int `json:"writetimeout"` // (optional) log output, default to stdout Log string `json:"log,omitempty"` // (optional) log output, default to 4 (notice) LogLevel int `json:"loglevel"` }
Config file
func ReadConfig ¶ added in v2.0.3
func (*Config) NewMuxConfig ¶
NewMuxConfig creates yamux.Config
func (*Config) NewTLSConfig ¶
NewTLSConfig creates tls.Config
func (*Config) SetConnParams ¶
SetConnParams sets TCP params
type ForwardHandler ¶
type ForwardHandler struct {
// contains filtered or unexported fields
}
ForwardHandler forwards connections to another plain address
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server object
func (*Server) LoadConfig ¶
LoadConfig reloads the configuration file
func (*Server) Stats ¶
func (s *Server) Stats() (stats ServerStats)
type ServerStats ¶
type TLSHandler ¶
type TLSHandler struct {
// contains filtered or unexported fields
}
TLSHandler creates a tunnel
func (*TLSHandler) Stats4Listener ¶ added in v2.0.3
func (h *TLSHandler) Stats4Listener() (numSessions uint32, numHalfOpen uint32)
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
func NewTunnel ¶
func NewTunnel(s *Server, c *TunnelConfig) *Tunnel
func (*Tunnel) NumSessions ¶
func (*Tunnel) Stats ¶
func (t *Tunnel) Stats() TunnelStats
type TunnelConfig ¶
type TunnelConfig struct { // (optional) tunnel identity Identity string `json:"identity,omitempty"` // (optional) local identity LocalIdentity string `json:"localidentity,omitempty"` // (optional) tunnel listen address MuxListen string `json:"muxlisten,omitempty"` // (optional) tunnel dial address MuxDial string `json:"muxdial,omitempty"` // (optional) forwarding listen address Listen string `json:"listen,omitempty"` // (optional) forwarding dial address Dial string `json:"dial,omitempty"` }
type TunnelHandler ¶
type TunnelHandler struct {
// contains filtered or unexported fields
}
TunnelHandler forwards connections over the tunnel
Source Files ¶
Click to show internal directories.
Click to hide internal directories.