router

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Overview

Package bsck provider tcp socket proxy router

the supported router is client->(slaver->master->slaver)*-server,

the channel of slaver to master can be multi physical tcp connect by different router

Index

Constants

View Source
const (
	//LogLevelDebug is debug log level
	LogLevelDebug = 40
	//LogLevelInfo is info log level
	LogLevelInfo = 30
	//LogLevelWarn is warn log level
	LogLevelWarn = 20
	//LogLevelError is error log level
	LogLevelError = 10
)
View Source
const (
	//CmdLogin is the command of login to master
	CmdLogin = 10
	//CmdLoginBack is the command of login return from master
	CmdLoginBack = 11
	//CmdDial is the command of tcp dial by router
	CmdDial = 100
	//CmdDialBack is the command of tcp dial back from master/slaver
	CmdDialBack = 101
	//CmdData is the command of transfter tcp data
	CmdData = 110
	//CmdClosed is the command of tcp closed.
	CmdClosed = 120
	//CmdHeartbeat is the command of heartbeat on slaver/master
	CmdHeartbeat = 130
)
View Source
const (
	//ConnTypeRaw is the type of raw connection
	ConnTypeRaw = 100
	//ConnTypeChannel is the type of channel connection
	ConnTypeChannel = 200
)
View Source
const RDPTemplate = `` /* 499-byte string literal not displayed */

RDPTemplate is the template string for rdp file

View Source
const VNCTemplate = `
FriendlyName=%v
FullScreen=1
Host=%v
Password=%v
RelativePtr=0
Scaling=100%%
`

VNCTemplate is the template string for vnc file

View Source
const Version = "2.0.0"

Version is bsrouter version

Variables

View Source
var ErrForwardNotExist = fmt.Errorf("%v", "forward not exist")

ErrForwardNotExist is forward is not exist error

View Source
var LogLevel = LogLevelInfo

LogLevel is log leveo config

Logger is the bsck package default log

View Source
var ShowLog = 0

ShowLog will show more log.

Functions

func DebugLog

func DebugLog(format string, args ...interface{})

DebugLog is the debug level log

func EncodeWebURI

func EncodeWebURI(format string, args ...interface{}) string

EncodeWebURI will replace string in () as base64 encoding

func ErrorLog

func ErrorLog(format string, args ...interface{})

ErrorLog is the error level log

func InfoLog

func InfoLog(format string, args ...interface{})

InfoLog is the info level log

func SetLogLevel

func SetLogLevel(l int)

SetLogLevel is set log level to l

func WarnLog

func WarnLog(format string, args ...interface{})

WarnLog is the warn level log

Types

type Channel

type Channel struct {
	frame.ReadWriteCloser //the raw connection

	Heartbeat time.Time
	// contains filtered or unexported fields
}

Channel is an implementation of the Conn interface for channel network connections.

func (*Channel) Context

func (c *Channel) Context() xmap.M

Context is conn context getter

func (*Channel) ID

func (c *Channel) ID() uint64

ID is an implementation of Conn

func (*Channel) Index

func (c *Channel) Index() int

Index is an implementation of Conn

func (*Channel) Name

func (c *Channel) Name() string

Name is an implementation of Conn

func (*Channel) RawValue

func (c *Channel) RawValue() (raw interface{})

func (*Channel) String

func (c *Channel) String() string

func (*Channel) Type

func (c *Channel) Type() int

Type is an implementation of Conn

type Config

type Config struct {
	Name    string            `json:"name"`
	Dir     string            `json:"dir"`
	Cert    string            `json:"cert"`
	Key     string            `json:"key"`
	Listen  string            `json:"listen"`
	ACL     map[string]string `json:"acl"`
	Access  [][]string        `json:"access"`
	Console struct {
		SOCKS string `json:"socks"`
		WS    string `json:"ws"`
	} `json:"console"`
	Web       Web               `json:"web"`
	Log       int               `json:"log"`
	Forwards  map[string]string `json:"forwards"`
	Channels  []xmap.M          `json:"channels"`
	Dialer    xmap.M            `json:"dialer"`
	Reconnect int64             `json:"reconnect"`
	RDPDir    string            `json:"rdp_dir"`
	VNCDir    string            `json:"vnc_dir"`
}

Config is struct for all configure

func ReadConfig

func ReadConfig(filename string) (config *Config, last int64, err error)

ReadConfig will read configure from file

type Conn

type Conn interface {
	//the basic ReadWriteCloser
	frame.ReadWriteCloser
	//the connection id
	ID() uint64
	//the channel name
	Name() string
	//the channel index.
	Index() int
	//the connection type
	Type() int
	//conn context getter
	Context() xmap.M
}

Conn is the interface that wraps the connection will be running on Router.

ID is the unique of connection

Name is the channel name, it will be used when join current connection to channel

Index is the channel index, it will be used when join current connection to channel.

Type is the connection type by ConnTypeRaw/ConnTypeChannel

type Console

type Console struct {
	Client     *xhttp.Client
	SlaverURI  string
	BufferSize int
	Env        []string
	Hosts      *Hosts //hosts to rewrite
	// contains filtered or unexported fields
}

Console is node console to dial connection

func NewConsole

func NewConsole(slaverURI string) (console *Console)

NewConsole will return new Console

func NewConsoleByConfig

func NewConsoleByConfig(config *Config) (console *Console, err error)

func (*Console) Close

func (c *Console) Close() (err error)

Close will close all connection

func (*Console) Dial

func (c *Console) Dial(uri string) (conn io.ReadWriteCloser, err error)

Dial will dial connection by uri

func (*Console) DialPiper

func (c *Console) DialPiper(uri string, bufferSize int) (raw xio.Piper, err error)

DialPiper will dial uri on router and return piper

func (*Console) Ping

func (c *Console) Ping(uri string, delay time.Duration, max uint64) (err error)

Ping will start ping to uri

func (*Console) PrintState

func (c *Console) PrintState(uri, query string) (err error)

PrintState will print state from uri

func (*Console) Proxy

func (c *Console) Proxy(uri string, process func(listener net.Listener) (err error)) (err error)

Proxy will start shell by runner and rewrite all tcp connection by console

func (*Console) ProxyExec

func (c *Console) ProxyExec(uri string, stdin io.Reader, stdout, stderr io.Writer, prepare func(listener net.Listener) (env []string, runner string, args []string, err error)) (err error)

ProxyExec will exec command by runner and rewrite all tcp connection by console

func (*Console) ProxyProcess

func (c *Console) ProxyProcess(uri string, stdin, stdout, stderr *os.File, prepare func(listener net.Listener) (env []string, runner string, args []string, err error)) (err error)

ProxyProcess will start process by runner and rewrite all tcp connection by console

func (*Console) ProxySSH

func (c *Console) ProxySSH(uri string, stdin io.Reader, stdout, stderr io.Writer, proxyCommand, command string, args ...string) (err error)

ProxySSH will start ssh client command and connect to uri by proxy command.

it will try load the ssh key from slaver forwarding by bs-ssh-key, bs-ssh-key is forwarding to http server and return ssh key in body by uri argument.

func (*Console) Redirect

func (c *Console) Redirect(uri string, reader io.Reader, writer io.Writer, closer io.Closer) (err error)

Redirect will redirect connection to reader/writer/closer

func (*Console) StartForward

func (c *Console) StartForward(loc string, uri string) (listener net.Listener, err error)

func (*Console) StartProxy

func (c *Console) StartProxy(loc, uri string) (server *proxy.Server, listener net.Listener, err error)

StartProxy will start proxy local to uri

type DialRawF

type DialRawF func(channel Conn, sid uint64, uri string) (raw Conn, err error)

DialRawF is a function type to dial raw connection.

func (DialRawF) DialRaw

func (d DialRawF) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)

DialRaw will dial raw connection

type Forward

type Forward struct {
	WebSuffix string
	WebAuth   string
	Dialer    func(uri string, raw io.ReadWriteCloser) (sid uint64, err error)
	// contains filtered or unexported fields
}

func NewForward

func NewForward() *Forward

func (*Forward) AddForward

func (f *Forward) AddForward(loc, uri string) (err error)

AddForward by local uri and remote uri

func (*Forward) FindForward

func (f *Forward) FindForward(name string) (uri ForwardUri)

FindForward will return the forward

func (*Forward) HostForwardF

func (f *Forward) HostForwardF(w http.ResponseWriter, req *http.Request)

func (*Forward) ProcName

func (f *Forward) ProcName(name string, w http.ResponseWriter, req *http.Request)

func (*Forward) ProcRouter

func (f *Forward) ProcRouter(router ForwardUri, w http.ResponseWriter, req *http.Request)

func (*Forward) ProcWebSubsH

func (f *Forward) ProcWebSubsH(w http.ResponseWriter, req *http.Request)

func (*Forward) RemoveForward

func (f *Forward) RemoveForward(name string) (err error)

RemoveForward by alias name

type ForwardEntry

type ForwardEntry []interface{}

ForwardEntry is the forward entry

type ForwardFinder

type ForwardFinder interface {
	FindForward(uri string) (target string, err error)
}

ForwardFinder is forward finder

type ForwardFinderF

type ForwardFinderF func(uri string) (target string, err error)

ForwardFinderF is func implement ForwardFinder

func (ForwardFinderF) FindForward

func (f ForwardFinderF) FindForward(uri string) (target string, err error)

FindForward is implement ForwardFinder

type ForwardUri

type ForwardUri []string

func (ForwardUri) String

func (f ForwardUri) String() string

type Handler

type Handler interface {
	//dial raw connection
	DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)
	//on connection dial uri
	OnConnDialURI(channel Conn, conn string, parts []string) (err error)
	//on connection login
	OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error)
	//on connection close
	OnConnClose(raw Conn) error
}

Handler is the interface that wraps the handler of Router.

type Hosts

type Hosts struct {
	Wildcard map[string]string
	Single   map[string]string
}

func NewHosts

func NewHosts() (hosts *Hosts)

func (*Hosts) Read

func (h *Hosts) Read(filename string) (err error)

func (*Hosts) Rewrite

func (h *Hosts) Rewrite(host string) (rewrited string, ok bool)

type InfoRWC

type InfoRWC struct {
	frame.ReadWriteCloser
	Raw  interface{}
	Info string
}

InfoRWC is external ReadWriteCloser to get info to String

func NewInfoRWC

func NewInfoRWC(raw interface{}, rwc frame.ReadWriteCloser, info string) *InfoRWC

NewInfoRWC will return new nfoRWC

func (*InfoRWC) RawValue

func (i *InfoRWC) RawValue() interface{}

func (*InfoRWC) String

func (i *InfoRWC) String() string

type NoneHandler

type NoneHandler struct {
}

NoneHandler is proxy handler

func NewNoneHandler

func NewNoneHandler() (handler *NoneHandler)

NewNoneHandler will return new NoneHandler

func (*NoneHandler) DialRaw

func (n *NoneHandler) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)

DialRaw will dial raw connection by uri

func (*NoneHandler) OnConnClose

func (n *NoneHandler) OnConnClose(conn Conn) (err error)

OnConnClose is event on connection close

func (*NoneHandler) OnConnDialURI

func (n *NoneHandler) OnConnDialURI(channel Conn, conn string, parts []string) (err error)

OnConnDialURI is event on connection dial to remote

func (*NoneHandler) OnConnJoin

func (n *NoneHandler) OnConnJoin(channel *Channel, option, result xmap.M) (err error)

OnConnJoin is event on channel join

func (*NoneHandler) OnConnLogin

func (n *NoneHandler) OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error)

OnConnLogin is event on connection login

type NormalAcessHandler

type NormalAcessHandler struct {
	Name        string            //the access name
	LoginAccess map[string]string //the access control

	DialAccess [][]string
	Dialer     RawDialer
	// contains filtered or unexported fields
}

NormalAcessHandler is normal access handler for proxy handler

func NewNormalAcessHandler

func NewNormalAcessHandler(name string, dialer RawDialer) (handler *NormalAcessHandler)

NewNormalAcessHandler will return new handler

func (*NormalAcessHandler) DialRaw

func (n *NormalAcessHandler) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)

DialRaw is proxy handler to dial remove

func (*NormalAcessHandler) OnConnClose

func (n *NormalAcessHandler) OnConnClose(conn Conn) (err error)

OnConnClose is proxy handler when connection is closed

func (*NormalAcessHandler) OnConnDialURI

func (n *NormalAcessHandler) OnConnDialURI(channel Conn, conn string, parts []string) (err error)

OnConnDialURI is proxy handler to handle dial uri

func (*NormalAcessHandler) OnConnJoin

func (n *NormalAcessHandler) OnConnJoin(channel *Channel, option, result xmap.M) (err error)

OnConnJoin is proxy handler when channel join

func (*NormalAcessHandler) OnConnLogin

func (n *NormalAcessHandler) OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error)

OnConnLogin is proxy handler to handle login

type Proxy

type Proxy struct {
	*Router                      //the router
	Running        bool          //proxy is running.
	ReconnectDelay time.Duration //reconnect delay
	Dir            string        //the work dir
	Cert           string        //the tls cert
	Key            string        //the tls key

	Handler ProxyHandler
	// contains filtered or unexported fields
}

Proxy is an implementation of proxy router

func NewProxy

func NewProxy(name string, handler ProxyHandler) (proxy *Proxy)

NewProxy will return new Proxy by name

func (*Proxy) AcceptWsConn

func (p *Proxy) AcceptWsConn(conn *websocket.Conn)

func (*Proxy) Close

func (p *Proxy) Close() (err error)

Close will close the tcp listen

func (*Proxy) DialRaw

func (p *Proxy) DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)

DialRaw will dial raw connection

func (*Proxy) ListenMaster

func (p *Proxy) ListenMaster(addr string) (err error)

ListenMaster will listen master router on address

func (*Proxy) Login

func (p *Proxy) Login(option xmap.M) (channel *Channel, result xmap.M, err error)

Login will add channel by local address, master address, auth token, channel index.

func (*Proxy) LoginChannel

func (p *Proxy) LoginChannel(reconnect bool, channels ...xmap.M) (err error)

LoginChannel will login all channel by options.

func (*Proxy) OnConnClose

func (p *Proxy) OnConnClose(conn Conn) (err error)

OnConnClose will be called when connection is closed

func (*Proxy) OnConnDialURI

func (p *Proxy) OnConnDialURI(channel Conn, conn string, parts []string) (err error)

OnConnDialURI is on connection dial uri

func (*Proxy) OnConnLogin

func (p *Proxy) OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error)

OnConnLogin is on connection login

func (*Proxy) StartForward

func (p *Proxy) StartForward(name string, listen *url.URL, router string) (listener net.Listener, err error)

StartForward will forward address to uri

func (*Proxy) StopForward

func (p *Proxy) StopForward(name string) (err error)

StopForward will forward address to uri

type ProxyHandler

type ProxyHandler interface {
	//DialRaw will dial raw connection by uri
	DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)
	//OnConnLogin is event on connection login
	OnConnLogin(channel Conn, args string) (name string, index int, result xmap.M, err error)
	//OnConnDialURI is event on connection dial to remote
	OnConnDialURI(channel Conn, conn string, parts []string) (err error)
	//OnConnClose is event on connection close
	OnConnClose(conn Conn) (err error)
	//OnConnJoin is event on channel join
	OnConnJoin(channel *Channel, option, result xmap.M) (err error)
}

ProxyHandler is proxy handler

type RawConn

type RawConn struct {
	//the raw connection
	*frame.BaseReadWriteCloser
	Raw io.ReadWriteCloser
	// contains filtered or unexported fields
}

RawConn is an implementation of the Conn interface for raw network connections.

func NewRawConn

func NewRawConn(name string, raw io.ReadWriteCloser, bufferSize int, sid uint64, uri string) (conn *RawConn)

NewRawConn returns a new RawConn by raw connection/session id/uri

func (*RawConn) Close

func (r *RawConn) Close() (err error)

Close will close the raw connection

func (*RawConn) Context

func (r *RawConn) Context() xmap.M

Context is conn context getter

func (*RawConn) ID

func (r *RawConn) ID() uint64

ID is an implementation of Conn

func (*RawConn) Index

func (r *RawConn) Index() int

Index is an implementation of Conn

func (*RawConn) Name

func (r *RawConn) Name() string

Name is an implementation of Conn

func (*RawConn) Read

func (r *RawConn) Read(b []byte) (n int, err error)

func (*RawConn) ReadFrame

func (r *RawConn) ReadFrame() (frame []byte, err error)

ReadFrame will read frame from raw

func (*RawConn) ReadFrom

func (r *RawConn) ReadFrom(reader io.Reader) (w int64, err error)

func (*RawConn) Ready

func (r *RawConn) Ready(failed error, next func(err error))

Ready is ConnectedWaiter impl

func (*RawConn) SetReadTimeout

func (r *RawConn) SetReadTimeout(timeout time.Duration)

SetReadTimeout is read timeout setter

func (*RawConn) SetTimeout

func (r *RawConn) SetTimeout(timeout time.Duration)

SetTimeout is read/write timeout setter

func (*RawConn) SetWriteTimeout

func (r *RawConn) SetWriteTimeout(timeout time.Duration)

SetWriteTimeout is write timeout setter

func (*RawConn) String

func (r *RawConn) String() string

func (*RawConn) Type

func (r *RawConn) Type() int

Type is an implementation of Conn

func (*RawConn) Wait

func (r *RawConn) Wait() error

Wait is ConnectedWaiter impl

func (*RawConn) Write

func (r *RawConn) Write(p []byte) (n int, err error)

func (*RawConn) WriteFrame

func (r *RawConn) WriteFrame(buffer []byte) (n int, err error)

WriteFrame will write frame to raw

func (*RawConn) WriteTo

func (r *RawConn) WriteTo(w io.Writer) (n int64, err error)

type RawDialer

type RawDialer interface {
	DialRaw(channel Conn, sid uint64, uri string) (raw Conn, err error)
}

RawDialer is dialer to dial raw by uri

type RawValuable

type RawValuable interface {
	RawValue() interface{}
}

type ReadyWaiter

type ReadyWaiter interface {
	Wait() error
	Ready(failed error, next func(err error))
}

ReadyWaiter interface for ready waiter

type Router

type Router struct {
	Name       string        //current router name
	BufferSize int           //buffer size of connection runner
	Heartbeat  time.Duration //the delay of heartbeat
	Handler    Handler       //the router handler
	// contains filtered or unexported fields
}

Router is an implementation of the router control

func NewRouter

func NewRouter(name string) (router *Router)

NewRouter will return new Router by name

func (*Router) Accept

func (r *Router) Accept(raw frame.ReadWriteCloser)

Accept one raw connection as channel, it will auth the raw connection by ACL.

func (*Router) AcceptSync

func (r *Router) AcceptSync(raw frame.ReadWriteCloser)

Accept one raw connection as channel, and loop read it it will auth the raw connection by ACL.

func (*Router) Close

func (r *Router) Close() (err error)

Close all channel

func (*Router) CloseChannel

func (r *Router) CloseChannel(name string) (err error)

CloseChannel will call close on all bond channle by name.

func (*Router) Dial

func (r *Router) Dial(uri string, raw io.ReadWriteCloser) (sid uint64, err error)

Dial to remote by uri and bind channel to raw connection.

return the session id

func (*Router) DialConn

func (r *Router) DialConn(uri string, raw io.ReadWriteCloser) (sid uint64, conn Conn, err error)

DialConn will dial to remote by uri and bind channel to raw connection and return raw connection

func (*Router) DialPiper

func (r *Router) DialPiper(uri string, bufferSize int) (raw xio.Piper, err error)

DialPiper will dial uri on router and return piper

func (*Router) JoinConn

func (r *Router) JoinConn(conn frame.ReadWriteCloser, index int, args interface{}) (channel *Channel, result xmap.M, err error)

JoinConn will add channel by the connected connection

func (*Router) Register

func (r *Router) Register(channel Conn)

Register one login raw connection to channel,

func (*Router) SelectChannel

func (r *Router) SelectChannel(name string) (dst Conn, err error)

SelectChannel will pick one channel by name.

func (*Router) StartHeartbeat

func (r *Router) StartHeartbeat()

StartHeartbeat will start the hearbeat on slaver/master

func (*Router) State

func (r *Router) State(args ...interface{}) (state xmap.M)

State return the current state of router

func (*Router) StateH

func (r *Router) StateH(w http.ResponseWriter, req *http.Request)

StateH return the current state of router

func (*Router) SyncDial

func (r *Router) SyncDial(uri string, raw io.ReadWriteCloser) (sid uint64, err error)

SyncDial will dial to remote by uri and wait dial successes

func (*Router) UniqueSid

func (r *Router) UniqueSid() (sid uint64)

UniqueSid will return new session id

type Service

type Service struct {
	Name    string
	Node    *Proxy
	Console struct {
		SOCKS *sproxy.Server
		WS    *wproxy.Server
	}
	Web        net.Listener
	Forward    *Forward
	Dialer     *dialer.Pool
	Handler    ProxyHandler
	Finder     ForwardFinder
	Config     *Config
	ConfigPath string
	Client     *xhttp.Client
	Webs       map[string]http.Handler
	BufferSize int
	OnReady    func()
	// contains filtered or unexported fields
}

Service is bound socket service

func NewService

func NewService() (s *Service)

NewService will return new Service

func (*Service) AddForward

func (s *Service) AddForward(loc, uri string) (err error)

AddForward will add forward by local and remote

func (*Service) DialAll

func (s *Service) DialAll(uris string, raw io.ReadWriteCloser, sync bool) (sid uint64, err error)

DialAll will dial uri by raw

func (*Service) DialNet

func (s *Service) DialNet(network, addr string) (conn net.Conn, err error)

DialNet is net dialer to router

func (*Service) DialPiper

func (s *Service) DialPiper(uri string, bufferSize int) (raw xio.Piper, err error)

DialPiper will dial uri on router and return piper

func (*Service) DialRaw

func (s *Service) DialRaw(channel Conn, sid uint64, uri string) (conn Conn, err error)

DialRaw is router dial implemnet

func (*Service) DialSSH

func (s *Service) DialSSH(uri string, config *ssh.ClientConfig) (client *ssh.Client, err error)

DialSSH is ssh dialer to ssh server

func (*Service) ReloadConfig

func (s *Service) ReloadConfig() (err error)

ReloadConfig will check configure modify time and reload

func (*Service) RemoveForward

func (s *Service) RemoveForward(loc string) (err error)

RemoveForward will remove forward

func (*Service) Start

func (s *Service) Start() (err error)

Start will start service

func (*Service) Stop

func (s *Service) Stop() (err error)

Stop will stop service

func (*Service) SyncDialAll

func (s *Service) SyncDialAll(uris string, raw io.ReadWriteCloser) (sid uint64, err error)

SyncDialAll will sync dial uri by raw

type TableRouter

type TableRouter []interface{}

TableRouter is the router table item

func (TableRouter) Next

func (t TableRouter) Next(conn Conn) (target Conn, sid uint64)

Next will return next connection and session id

func (TableRouter) String

func (t TableRouter) String() string

type WaitReadWriteCloser

type WaitReadWriteCloser struct {
	io.ReadWriteCloser
	// contains filtered or unexported fields
}

func NewWaitReadWriteCloser

func NewWaitReadWriteCloser(raw io.ReadWriteCloser) *WaitReadWriteCloser

func (*WaitReadWriteCloser) Close

func (w *WaitReadWriteCloser) Close() (err error)

func (*WaitReadWriteCloser) String

func (w *WaitReadWriteCloser) String() string

func (*WaitReadWriteCloser) Wait

func (w *WaitReadWriteCloser) Wait()

type WaitedPiper

type WaitedPiper struct {
	Base io.ReadWriteCloser
	// contains filtered or unexported fields
}

WaitedPiper is Waiter/Piper implement

func NewWaitedPiper

func NewWaitedPiper() (piper *WaitedPiper)

NewWaitedPiper will return new WaitedPiper

func (*WaitedPiper) Close

func (r *WaitedPiper) Close() (err error)

Close will close ready piper, it will lock when it is not ready

func (*WaitedPiper) PipeConn

func (r *WaitedPiper) PipeConn(conn io.ReadWriteCloser, target string) (err error)

PipeConn will pipe connection, it must be called after Wait success, or panic

func (*WaitedPiper) Read

func (r *WaitedPiper) Read(p []byte) (n int, err error)

func (*WaitedPiper) Ready

func (r *WaitedPiper) Ready(failed error, next func(err error))

Ready will set piper is ready, failed/next at lasted is not nil

func (*WaitedPiper) String

func (r *WaitedPiper) String() string

func (*WaitedPiper) Wait

func (r *WaitedPiper) Wait() error

Wait will wait piper is ready

func (*WaitedPiper) Write

func (r *WaitedPiper) Write(p []byte) (n int, err error)

type Web

type Web struct {
	Suffix string `json:"suffix"`
	Listen string `json:"listen"`
	Auth   string `json:"auth"`
}

Web is struct for web configure

Jump to

Keyboard shortcuts

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