Versions in this module Expand all Collapse all v0 v0.1.1 May 22, 2023 Changes in this version + const CmdClosed + const CmdData + const CmdDial + const CmdDialBack + const CmdHeartbeat + const CmdLogin + const CmdLoginBack + const ConnTypeChannel + const ConnTypeRaw + const LogLevelDebug + const LogLevelError + const LogLevelInfo + const LogLevelWarn + const RDPTemplate + const VNCTemplate + const Version + var ErrForwardNotExist = fmt.Errorf("%v", "forward not exist") + var LogLevel = LogLevelInfo + var Logger = log.New(os.Stdout, "", log.Ldate | log.Lmicroseconds | log.Lshortfile) + var ShowLog = 0 + func DebugLog(format string, args ...interface{}) + func EncodeWebURI(format string, args ...interface{}) string + func ErrorLog(format string, args ...interface{}) + func InfoLog(format string, args ...interface{}) + func SetLogLevel(l int) + func WarnLog(format string, args ...interface{}) + type Channel struct + Heartbeat time.Time + func (c *Channel) Context() xmap.M + func (c *Channel) ID() uint64 + func (c *Channel) Index() int + func (c *Channel) Name() string + func (c *Channel) RawValue() (raw interface{}) + func (c *Channel) String() string + func (c *Channel) Type() int + type Config struct + ACL map[string]string + Access [][]string + Cert string + Channels []xmap.M + Console struct{ ... } + Dialer xmap.M + Dir string + Forwards map[string]string + Key string + Listen string + Log int + Name string + RDPDir string + Reconnect int64 + VNCDir string + Web Web + func ReadConfig(filename string) (config *Config, last int64, err error) + type Conn interface + Context func() xmap.M + ID func() uint64 + Index func() int + Name func() string + Type func() int + type Console struct + BufferSize int + Client *xhttp.Client + Env []string + Hosts *Hosts + SlaverURI string + func NewConsole(slaverURI string) (console *Console) + func NewConsoleByConfig(config *Config) (console *Console, err error) + func (c *Console) Close() (err error) + func (c *Console) Dial(uri string) (conn io.ReadWriteCloser, err error) + func (c *Console) DialPiper(uri string, bufferSize int) (raw xio.Piper, err error) + func (c *Console) Ping(uri string, delay time.Duration, max uint64) (err error) + func (c *Console) PrintState(uri, query string) (err error) + func (c *Console) Proxy(uri string, process func(listener net.Listener) (err error)) (err error) + func (c *Console) ProxyExec(uri string, stdin io.Reader, stdout, stderr io.Writer, ...) (err error) + func (c *Console) ProxyProcess(uri string, stdin, stdout, stderr *os.File, ...) (err error) + func (c *Console) ProxySSH(uri string, stdin io.Reader, stdout, stderr io.Writer, ...) (err error) + func (c *Console) Redirect(uri string, reader io.Reader, writer io.Writer, closer io.Closer) (err error) + func (c *Console) StartForward(loc string, uri string) (listener net.Listener, err error) + func (c *Console) StartProxy(loc, uri string) (server *proxy.Server, listener net.Listener, err error) + type DialRawF func(channel Conn, sid uint64, uri string) (raw Conn, err error) + func (d DialRawF) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err 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 ForwardFinder interface + FindForward func(uri string) (target string, err error) + type ForwardFinderF func(uri string) (target string, err error) + func (f ForwardFinderF) FindForward(uri string) (target string, err error) + type ForwardUri []string + func (f ForwardUri) String() string + type Handler interface + DialRaw func(channel Conn, sid uint64, uri string) (raw Conn, err error) + OnConnClose func(raw Conn) error + OnConnDialURI func(channel Conn, conn string, parts []string) (err error) + OnConnLogin func(channel Conn, args string) (name string, index int, result xmap.M, err error) + type Hosts struct + Single map[string]string + Wildcard map[string]string + func NewHosts() (hosts *Hosts) + func (h *Hosts) Read(filename string) (err error) + func (h *Hosts) Rewrite(host string) (rewrited string, ok bool) + type InfoRWC struct + Info string + Raw interface{} + func NewInfoRWC(raw interface{}, rwc frame.ReadWriteCloser, info string) *InfoRWC + func (i *InfoRWC) RawValue() interface{} + func (i *InfoRWC) String() string + type NoneHandler struct + func NewNoneHandler() (handler *NoneHandler) + func (n *NoneHandler) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error) + func (n *NoneHandler) OnConnClose(conn Conn) (err error) + func (n *NoneHandler) OnConnDialURI(channel Conn, conn string, parts []string) (err error) + func (n *NoneHandler) OnConnJoin(channel *Channel, option, result xmap.M) (err error) + func (n *NoneHandler) OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error) + type NormalAcessHandler struct + DialAccess [][]string + Dialer RawDialer + LoginAccess map[string]string + Name string + func NewNormalAcessHandler(name string, dialer RawDialer) (handler *NormalAcessHandler) + func (n *NormalAcessHandler) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error) + func (n *NormalAcessHandler) OnConnClose(conn Conn) (err error) + func (n *NormalAcessHandler) OnConnDialURI(channel Conn, conn string, parts []string) (err error) + func (n *NormalAcessHandler) OnConnJoin(channel *Channel, option, result xmap.M) (err error) + func (n *NormalAcessHandler) OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error) + type Proxy struct + Cert string + Dir string + Handler ProxyHandler + Key string + ReconnectDelay time.Duration + Running bool + func NewProxy(name string, handler ProxyHandler) (proxy *Proxy) + func (p *Proxy) AcceptWsConn(conn *websocket.Conn) + func (p *Proxy) Close() (err error) + func (p *Proxy) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error) + func (p *Proxy) ListenMaster(addr string) (err error) + func (p *Proxy) Login(option xmap.M) (channel *Channel, result xmap.M, err error) + func (p *Proxy) LoginChannel(reconnect bool, channels ...xmap.M) (err error) + func (p *Proxy) OnConnClose(conn Conn) (err error) + func (p *Proxy) OnConnDialURI(channel Conn, conn string, parts []string) (err error) + func (p *Proxy) OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err 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 ProxyHandler interface + DialRaw func(channel Conn, sid uint64, uri string) (raw Conn, err error) + OnConnClose func(conn Conn) (err error) + OnConnDialURI func(channel Conn, conn string, parts []string) (err error) + OnConnJoin func(channel *Channel, option, result xmap.M) (err error) + OnConnLogin func(channel Conn, args string) (name string, index int, result xmap.M, err error) + type RawConn struct + Raw io.ReadWriteCloser + func NewRawConn(name string, raw io.ReadWriteCloser, bufferSize int, sid uint64, uri string) (conn *RawConn) + func (r *RawConn) Close() (err error) + func (r *RawConn) Context() xmap.M + 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) ReadFrame() (frame []byte, err error) + func (r *RawConn) ReadFrom(reader io.Reader) (w int64, err error) + func (r *RawConn) Ready(failed error, next func(err error)) + func (r *RawConn) SetReadTimeout(timeout time.Duration) + func (r *RawConn) SetTimeout(timeout time.Duration) + func (r *RawConn) SetWriteTimeout(timeout time.Duration) + func (r *RawConn) String() string + func (r *RawConn) Type() int + func (r *RawConn) Wait() error + func (r *RawConn) Write(p []byte) (n int, err error) + func (r *RawConn) WriteFrame(buffer []byte) (n int, err error) + func (r *RawConn) WriteTo(w io.Writer) (n int64, err error) + type RawDialer interface + DialRaw func(channel Conn, sid uint64, uri string) (raw Conn, err error) + type RawValuable interface + RawValue func() interface{} + type ReadyWaiter interface + Ready func(failed error, next func(err error)) + Wait func() error + type Router struct + BufferSize int + Handler Handler + Heartbeat time.Duration + Name string + func NewRouter(name string) (router *Router) + func (r *Router) Accept(raw frame.ReadWriteCloser) + func (r *Router) AcceptSync(raw frame.ReadWriteCloser) + func (r *Router) Close() (err error) + func (r *Router) CloseChannel(name string) (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 Conn, err error) + func (r *Router) DialPiper(uri string, bufferSize int) (raw xio.Piper, err error) + func (r *Router) JoinConn(conn frame.ReadWriteCloser, index int, args interface{}) (channel *Channel, result xmap.M, 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(args ...interface{}) (state xmap.M) + func (r *Router) StateH(w http.ResponseWriter, req *http.Request) + func (r *Router) SyncDial(uri string, raw io.ReadWriteCloser) (sid uint64, err error) + func (r *Router) UniqueSid() (sid uint64) + type Service struct + BufferSize int + Client *xhttp.Client + Config *Config + ConfigPath string + Console struct{ ... } + Dialer *dialer.Pool + Finder ForwardFinder + Forward *Forward + Handler ProxyHandler + Name string + Node *Proxy + OnReady func() + Web net.Listener + Webs map[string]http.Handler + func NewService() (s *Service) + func (s *Service) AddForward(loc, uri string) (err error) + func (s *Service) DialAll(uris string, raw io.ReadWriteCloser, sync bool) (sid uint64, err error) + func (s *Service) DialNet(network, addr string) (conn net.Conn, err error) + func (s *Service) DialPiper(uri string, bufferSize int) (raw xio.Piper, err error) + func (s *Service) DialRaw(channel Conn, sid uint64, uri string) (conn Conn, err error) + func (s *Service) DialSSH(uri string, config *ssh.ClientConfig) (client *ssh.Client, err error) + func (s *Service) ReloadConfig() (err error) + func (s *Service) RemoveForward(loc string) (err error) + func (s *Service) Start() (err error) + func (s *Service) Stop() (err error) + func (s *Service) SyncDialAll(uris string, raw io.ReadWriteCloser) (sid uint64, err error) + type TableRouter []interface + func (t TableRouter) Next(conn Conn) (target Conn, sid 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() + type WaitedPiper struct + Base io.ReadWriteCloser + func NewWaitedPiper() (piper *WaitedPiper) + func (r *WaitedPiper) Close() (err error) + func (r *WaitedPiper) PipeConn(conn io.ReadWriteCloser, target string) (err error) + func (r *WaitedPiper) Read(p []byte) (n int, err error) + func (r *WaitedPiper) Ready(failed error, next func(err error)) + func (r *WaitedPiper) String() string + func (r *WaitedPiper) Wait() error + func (r *WaitedPiper) Write(p []byte) (n int, err error) + type Web struct + Auth string + Listen string + Suffix string