Documentation
¶
Index ¶
Constants ¶
View Source
const ( Success = iota NotExists InvalidPassword AlreadyInUse Unexpected Unsupported )
View Source
const ( ControlConn = iota WorkConn )
View Source
const ( Idle = iota Working )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientCtlReq ¶
type ClientCtlRes ¶
type ClientCtlRes struct {
GeneralRes
}
type GeneralRes ¶
type ProxyClient ¶
type ProxyClient struct {
// Actively connect to the public server, double forwarding
// self (nat) -> server1 (public) && self (nat) -> server2 (nat) => client <-> server1 <-> server2
Name string `yaml:"Name,omitempty"`
Password string `yaml:"Password,omitempty"`
LocalHost string `yaml:"LocalHost,omitempty"`
LocalPort int64 `yaml:"LocalPort,omitempty"`
// Passive listening port, then actively forwarding to local server
// client -> self (public) -> server (nat) => client <-> server
PassiveMode bool `yaml:"PassiveMode,omitempty"`
BindAddr string `yaml:"BindAddr,omitempty"`
BindPort int64 `yaml:"BindPort,omitempty"`
}
func (*ProxyClient) GetLocalConn ¶
func (p *ProxyClient) GetLocalConn() (c *conn.Conn, err error)
func (*ProxyClient) GetRemoteConn ¶
func (*ProxyClient) StartTunnel ¶
func (p *ProxyClient) StartTunnel(serverAddr string, serverPort int64) (err error)
type ProxyServer ¶
type ProxyServer struct {
Name string `yaml:"Name,omitempty"`
Password string `yaml:"Password,omitempty"`
BindAddr string `yaml:"BindAddr,omitempty"`
ListenPort int64 `yaml:"ListenPort,omitempty"`
Status int64 `yaml:"-"`
Listener *conn.Listener `yaml:"-"` // accept new connection from remote users
CtlMsgChan chan int64 `yaml:"-"` // every time accept a new user conn, put "1" to the channel
CliConnChan chan *conn.Conn `yaml:"-"` // get client conns from control goroutine
UserConnList *list.List `yaml:"-"` // store user conns
Mutex sync.Mutex `yaml:"-"`
}
func (*ProxyServer) Close ¶
func (p *ProxyServer) Close()
func (*ProxyServer) Init ¶
func (p *ProxyServer) Init()
func (*ProxyServer) Lock ¶
func (p *ProxyServer) Lock()
func (*ProxyServer) Start ¶
func (p *ProxyServer) Start() (err error)
func (*ProxyServer) Unlock ¶
func (p *ProxyServer) Unlock()
func (*ProxyServer) WaitUserConn ¶
func (p *ProxyServer) WaitUserConn() (res int64)
type ServerCtlReq ¶
type ServerCtlReq struct {
Type int `json:"Type"`
}
Click to show internal directories.
Click to hide internal directories.