core

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBrokenSIP003Args = errors.New("invalid SIP003 args")
)

err

Functions

func FormatSSPluginOptions

func FormatSSPluginOptions(spo string) ([]string, error)

FormatSSPluginOptions formats SS_PLUGIN_OPTIONS to command alike formation, `-s -a value`

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a client instance

func NewClient

func NewClient(c *ClientConfig) (*Client, error)

NewClient inits a client instance

func (*Client) Close

func (client *Client) Close() error

Close shutdown client

func (*Client) Start

func (client *Client) Start() error

Start starts the client, it block

type ClientConfig

type ClientConfig struct {
	BindAddr           string
	RemoteAddr         string
	EnableWSS          bool
	WSSPath            string
	ServerName         string
	InsecureSkipVerify bool
	EnableMux          bool
	MuxMaxStream       int
	Timeout            time.Duration
	EnableTFO          bool
	VpnMode            bool
	FallbackDNS        string
	Verbose            bool
}

ClientConfig is a config

type SIP003Args

type SIP003Args struct {
	SS_REMOTE_HOST    string
	SS_REMOTE_PORT    string
	SS_LOCAL_HOST     string
	SS_LOCAL_PORT     string
	SS_PLUGIN_OPTIONS string
	VPN               bool
	TFO               bool
}

SIP003Args contains sip003 args

func GetSIP003Args

func GetSIP003Args() (*SIP003Args, error)

GetSIP003Args get sip003 args from os.Environ(), if no args, returns nil

func (*SIP003Args) GetLocalAddr

func (args *SIP003Args) GetLocalAddr() string

func (*SIP003Args) GetRemoteAddr

func (args *SIP003Args) GetRemoteAddr() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents a Server instance

func NewServer

func NewServer(c *ServerConfig) (*Server, error)

func (*Server) Close

func (server *Server) Close() error

Close shutdown server

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler interface

func (*Server) Start

func (server *Server) Start() error

type ServerConfig

type ServerConfig struct {
	BindAddr   string
	DstAddr    string
	Key        string
	Cert       string
	EnableWSS  bool
	WSSPath    string
	ServerName string
	EnableMux  bool
	Timeout    time.Duration
	EnableTFO  bool
	Verbose    bool
}

ServerConfig is a config

Jump to

Keyboard shortcuts

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