pxlocal

package
v0.0.0-...-c4753be Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCP  = ProxyProtocol("tcp")
	HTTP = ProxyProtocol("http")
)
View Source
const (
	TCP_MIN_PORT = 40000
	TCP_MAX_PORT = 50000

	TYPE_NEWCONN = iota + 1
	TYPE_MESSAGE
	TYPE_IDLE
)
View Source
const (
	HOOK_TCP_POST_CONNECT = "tcp-post-connect"
)

Variables

View Source
var (
	ErrWebsocketBroken  = errors.New("Error websocket connection")
	ErrDialTCP          = errors.New("Error dial tcp connection")
	ErrUnknownProtocol  = errors.New("Unknown protocol")
	ErrPrototolRequired = errors.New("Protocol required")
)

Functions

func ParseURL

func ParseURL(s string, opts ...URLOpts) (u *url.URL, err error)

Types

type Client

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

func NewClient

func NewClient(serverAddr string) *Client

Proxy Client

func (*Client) RunProxy

func (c *Client) RunProxy(opts ProxyOptions) (pc *ProxyConnector, err error)

This is a immediately return function

type ProxyConnector

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

func (*ProxyConnector) Close

func (p *ProxyConnector) Close() error

func (*ProxyConnector) RemoteAddr

func (p *ProxyConnector) RemoteAddr() string

func (*ProxyConnector) Wait

func (p *ProxyConnector) Wait() error

type ProxyOptions

type ProxyOptions struct {
	LocalAddr  string
	Proto      ProxyProtocol
	Subdomain  string
	ListenPort int
	ExtraData  string
}

type ProxyProtocol

type ProxyProtocol string

type ProxyServer

type ProxyServer struct {
	*http.ServeMux

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewProxyServer

func NewProxyServer(domain string) *ProxyServer

domain, ex shengxiang.me dns should set *.shengxiang.me

func (*ProxyServer) ServeHTTP

func (p *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProxyStats

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

A proxy represents a pair of connections and their state

type RequestInfo

type RequestInfo struct {
	Protocol  string
	Subdomain string
	Port      int
	Data      string
}

type URLOpts

type URLOpts struct {
	DefaultScheme string
	DefaultHost   string
	DefaultPort   int
}

Jump to

Keyboard shortcuts

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