v0.0.0-...-dccbea2 Latest Latest

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

Go to latest
Published: Nov 5, 2020 License: LGPL-2.1 Imports: 23 Imported by: 0




This section is empty.


View Source
var (

	// ServerCert ...
	ServerCert = ".wsproxy/certs/server.crt"

	// ServerKey ...
	ServerKey = ".wsproxy/certs/server.key"

	// ClientCert ...
	ClientCert = ".wsproxy/certs/client.crt"

	// ClientKey ...
	ClientKey = ".wsproxy/certs/client.key"

	// UnixSockAddr ...
	UnixSockAddr = "wsproxy.sock"

	// JSONConfig ...
	JSONConfig = "config.json"

	// DisableProxy 表示只开启wss服务, 不启用socks5/http proxy服务.
	DisableProxy = false

	// ServerTLSConfig ...
	ServerTLSConfig *tls.Config

	// Users for auth ...
	Users map[string]string

	// ConnectionID ...
	ConnectionID uint64

	// Encoding ...
	Encoding string


func StartConnectServer

func StartConnectServer(ID uint64, Verify bool, tcpConn *net.TCPConn,
	reader *bufio.Reader, writer *bufio.Writer, server string) (insize, tosize int)

StartConnectServer ...

func StartHTTPProxy

func StartHTTPProxy(ID uint64, tcpConn *bufio.ReadWriter, handler AuthHandlerFunc,
	reader *bufio.Reader, writer *bufio.Writer)

StartHTTPProxy ...

func StartSocks5Proxy

func StartSocks5Proxy(ID uint64, tcpConn *bufio.ReadWriter, handler AuthHandlerFunc,
	reader *bufio.Reader, writer *bufio.Writer)

StartSocks5Proxy ...


type AuthHander

type AuthHander interface {
	Auth(string, string) bool

AuthHander interface ...

type AuthHandlerFunc

type AuthHandlerFunc func(string, string) bool

AuthHandlerFunc ...

type Configuration

type Configuration struct {
	Servers                []string   `json:"Servers"`
	ServerVerifyClientCert bool       `json:"VerifyClientCert"`
	Listen                 string     `json:"ListenAddr"`
	DisableProxy           bool       `json:"DisableProxy"`
	Users                  []UserInfo `json:"Users"`
	UpstreamProxyServer    string     `json:"UpstreamProxyServer"`
	Encoding               string     `json:"Encoding"`

Configuration ...

type Server

type Server struct {
	// contains filtered or unexported fields

Server ...

func NewServer

func NewServer(serverList []string) *Server

NewServer ...

func (*Server) AuthHandleFunc

func (s *Server) AuthHandleFunc(handler func(string, string) bool)

AuthHandleFunc ...

func (*Server) Start

func (s *Server) Start(addr string) error

Start start wserver...

func (*Server) StartUnixSocket

func (s *Server) StartUnixSocket() error

StartUnixSocket ...

func (*Server) StartWithAuth

func (s *Server) StartWithAuth(addr string, handler AuthHander) error

StartWithAuth start wserver...

func (*Server) Stop

func (s *Server) Stop()

Stop stop socks5 server ...

type UserInfo

type UserInfo struct {
	User   string
	Passwd string

UserInfo ...

Jump to

Keyboard shortcuts

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