Versions in this module Expand all Collapse all v1 v1.4.2 Oct 31, 2018 Changes in this version + const CmdClosed + const CmdData + const CmdDial + const CmdDialBack + const CmdHeartbeat + const CmdLogin + const CmdLoginBack + const ConnTypeChannel + const ConnTypeRaw + const SocksUriTypeBS + const SocksUriTypeNormal + var Log = log.New(os.Stdout, "", log.Ldate | log.Lmicroseconds | log.Lshortfile) + var ShowLog = 0 + func DebugLog(format string, args ...interface{}) + func ErrorLog(format string, args ...interface{}) + func InfoLog(format string, args ...interface{}) + func WarnLog(format string, args ...interface{}) + type AuthOption struct + Index int + Name string + Token string + type BufferConn struct + Raw io.ReadWriteCloser + func NewBufferConn(raw io.ReadWriteCloser, bufferSize int) (buf *BufferConn) + func (b *BufferConn) Close() (err error) + func (b *BufferConn) String() string + type Channel struct + Heartbeat int64 + Option *ChannelOption + func (c *Channel) ID() uint64 + func (c *Channel) Index() int + func (c *Channel) Name() string + func (c *Channel) String() string + func (c *Channel) Type() int + type ChannelOption struct + Enable bool + Index int + Local string + Remote string + Token string + type CmdReader interface + ReadCmd func(b []byte) (n uint32, err error) + type Codable interface + Code func() byte + type Conn interface + ID func() uint64 + Index func() int + Name func() string + Type func() int + type ConnectedWaiter interface + Ready func() + Wait func() bool + type DialRawF func(sid uint64, uri string) (raw Conn, err error) + func (d DialRawF) DialRaw(sid uint64, uri string) (raw Conn, err error) + func (d DialRawF) OnConnClose(conn Conn) error + type Forward struct + Dialer func(uri string, raw io.ReadWriteCloser) (sid uint64, err error) + WebAuth string + WebSuffix string + func NewForward() *Forward + func (f *Forward) AddForward(loc, uri string) (err error) + func (f *Forward) FindForward(name string) (uri ForwardUri) + func (f *Forward) HostForwardF(w http.ResponseWriter, req *http.Request) + func (f *Forward) ProcName(name string, w http.ResponseWriter, req *http.Request) + func (f *Forward) ProcRouter(router ForwardUri, w http.ResponseWriter, req *http.Request) + func (f *Forward) ProcWebSubsH(w http.ResponseWriter, req *http.Request) + func (f *Forward) RemoveForward(name string) (err error) + type ForwardEntry []interface + type ForwardUri []string + func (f ForwardUri) String() string + func (f ForwardUri) URL() (local *url.URL, remote *url.URL, err error) + type InfoRWC struct + Info string + func NewInfoRWC(raw io.ReadWriteCloser, info string) *InfoRWC + func (i *InfoRWC) String() string + type PendingConn struct + Raw io.ReadWriteCloser + func NewPendingConn(raw io.ReadWriteCloser) (conn *PendingConn) + func (p *PendingConn) Close() (err error) + func (p *PendingConn) Read(b []byte) (n int, err error) + func (p *PendingConn) Start() + func (p *PendingConn) Write(b []byte) (n int, err error) + type Proxy struct + Cert string + Handler RouterHandler + Key string + ReconnectDelay time.Duration + Running bool + func NewProxy(name string) (proxy *Proxy) + func (p *Proxy) Close() (err error) + func (p *Proxy) DialRaw(sid uint64, uri string) (raw Conn, err error) + func (p *Proxy) ListenMaster(addr string) (err error) + func (p *Proxy) Login(option *ChannelOption) (err error) + func (p *Proxy) LoginChannel(reconnect bool, channels ...*ChannelOption) (err error) + func (p *Proxy) OnConnClose(conn Conn) error + func (p *Proxy) StartForward(name string, listen *url.URL, router string) (listener net.Listener, err error) + func (p *Proxy) StopForward(name string) (err error) + type RawConn struct + Raw io.ReadWriteCloser + func NewRawConn(raw io.ReadWriteCloser, sid uint64, uri string) (conn *RawConn) + func (r *RawConn) Close() (err error) + func (r *RawConn) ID() uint64 + func (r *RawConn) Index() int + func (r *RawConn) Name() string + func (r *RawConn) Read(b []byte) (n int, err error) + func (r *RawConn) ReadCmd(b []byte) (n uint32, err error) + func (r *RawConn) Ready() + func (r *RawConn) String() string + func (r *RawConn) Type() int + func (r *RawConn) Wait() bool + func (r *RawConn) Write(p []byte) (n int, err error) + type Router struct + ACL map[string]string + BufferSize uint32 + Handler RouterHandler + Heartbeat time.Duration + Name string + func NewRouter(name string) (router *Router) + func (r *Router) Accept(raw io.ReadWriteCloser) + func (r *Router) Bind(src Conn, srcSid uint64, dst Conn, dstSid uint64) + func (r *Router) Close() (err error) + func (r *Router) Dial(uri string, raw io.ReadWriteCloser) (sid uint64, err error) + func (r *Router) DialConn(uri string, raw io.ReadWriteCloser) (sid uint64, conn *RawConn, err error) + func (r *Router) JoinConn(conn io.ReadWriteCloser, option *ChannelOption) (err error) + func (r *Router) Register(channel Conn) + func (r *Router) SelectChannel(name string) (dst Conn, err error) + func (r *Router) StartHeartbeat() + func (r *Router) State() (state util.Map) + func (r *Router) SyncDial(uri string, raw io.ReadWriteCloser) (sid uint64, err error) + func (r *Router) UniqueSid() (sid uint64) + type RouterHandler interface + DialRaw func(sid uint64, uri string) (raw Conn, err error) + OnConnClose func(conn Conn) error + type SocksProxy struct + Dialer func(utype int, uri string, raw io.ReadWriteCloser) (sid uint64, err error) + func NewSocksProxy() (socks *SocksProxy) + func (s *SocksProxy) Start(addr string) (err error) + type TableRouter []interface + func (t TableRouter) Next(conn Conn) (target Conn, rsid uint64) + func (t TableRouter) String() string + type WaitReadWriteCloser struct + func NewWaitReadWriteCloser(raw io.ReadWriteCloser) *WaitReadWriteCloser + func (w *WaitReadWriteCloser) Close() (err error) + func (w *WaitReadWriteCloser) String() string + func (w *WaitReadWriteCloser) Wait()