Documentation
¶
Index ¶
- Variables
- func IsReplay(key string) bool
- func SetClientSelectMode(v any) error
- type Bridge
- func (s *Bridge) CliProcess(c *conn.Conn, tunnelType string)
- func (s *Bridge) DelClient(id int)
- func (s *Bridge) GetHealthFromClient(id int, c *conn.Conn, client *Client, node *Node)
- func (s *Bridge) IsServer() bool
- func (s *Bridge) SendLinkInfo(clientId int, link *conn.Link, t *file.Tunnel) (target net.Conn, err error)
- func (s *Bridge) StartP2P(cfg P2PConfig) error
- func (s *Bridge) StartTunnel() error
- func (s *Bridge) StopP2P()
- type Client
- func (c *Client) AddFile(key, uuid string) error
- func (c *Client) AddNode(n *Node)
- func (c *Client) CheckNode() *Node
- func (c *Client) Close() error
- func (c *Client) GetNode() *Node
- func (c *Client) GetNodeByFile(key string) (*Node, bool)
- func (c *Client) GetNodeByUUID(uuid string) (*Node, bool)
- func (c *Client) InConnectGraceWindow(window time.Duration) bool
- func (c *Client) IsClosed() bool
- func (c *Client) MarkConnectedNow()
- func (c *Client) NodeCount() int
- func (c *Client) RemoveFile(key string)
- func (c *Client) RemoveOfflineNodes(ignoreClientGrace bool) (removed int)
- func (c *Client) RemoveOfflineNodesExcept(keepUUID string, ignoreClientGrace bool) (removed int)
- type IdleTimer
- type Node
- func (n *Node) AddNode(node *Node)
- func (n *Node) AddSignal(signal *conn.Conn)
- func (n *Node) AddTunnel(tunnel any)
- func (n *Node) Close() error
- func (n *Node) CloseIfSignalCurrent(signal *conn.Conn) bool
- func (n *Node) CloseIfTunnelCurrent(tunnel any) bool
- func (n *Node) GetSignal() *conn.Conn
- func (n *Node) GetTunnel() any
- func (n *Node) InJoinGraceWindow(window time.Duration) bool
- func (n *Node) IsOffline() bool
- func (n *Node) IsOnline() bool
- func (n *Node) IsTunnelClosed() bool
- func (n *Node) Retry() bool
- type P2PConfig
- type SelectMode
Constants ¶
This section is empty.
Variables ¶
var ( ServerTcpEnable = false ServerKcpEnable = false ServerQuicEnable = false ServerTlsEnable = false ServerWsEnable = false ServerWssEnable = false ServerSecureMode = false )
var ClientSelectMode = Primary
Functions ¶
func SetClientSelectMode ¶ added in v0.30.3
Types ¶
type Bridge ¶
type Bridge struct {
Client *sync.Map
Register *sync.Map
VirtualTcpListener *netx.ChanListener
VirtualTlsListener *netx.ChanListener
VirtualWsListener *netx.ChanListener
VirtualWssListener *netx.ChanListener
OpenHost chan *file.Host
OpenTask chan *file.Tunnel
CloseTask chan *file.Tunnel
CloseClient chan int
SecretChan chan *conn.Secret
// contains filtered or unexported fields
}
func (*Bridge) CliProcess ¶ added in v0.33.7
func (*Bridge) GetHealthFromClient ¶
func (*Bridge) SendLinkInfo ¶
func (*Bridge) StartP2P ¶ added in v0.34.8
StartP2P starts the NAT observers and the coordinator. It must be called before the bridge serves clients; without it P2P requests are refused.
func (*Bridge) StartTunnel ¶
type Client ¶
func (*Client) GetNodeByFile ¶ added in v0.30.6
func (*Client) GetNodeByUUID ¶ added in v0.32.0
func (*Client) InConnectGraceWindow ¶ added in v0.34.5
func (*Client) MarkConnectedNow ¶ added in v0.34.5
func (c *Client) MarkConnectedNow()
func (*Client) RemoveFile ¶ added in v0.30.6
func (*Client) RemoveOfflineNodes ¶ added in v0.31.1
type IdleTimer ¶ added in v0.32.0
type IdleTimer struct {
// contains filtered or unexported fields
}
func NewIdleTimer ¶ added in v0.32.0
type Node ¶ added in v0.30.6
type Node struct {
Client *Client
UUID string
Version string
BaseVer int
// contains filtered or unexported fields
}
func (*Node) CloseIfSignalCurrent ¶ added in v0.34.8
CloseIfSignalCurrent closes the node only while signal is still its signal connection, so that an outdated connection exiting cannot tear down a node that has been taken over by a newer connection with the same UUID.
func (*Node) CloseIfTunnelCurrent ¶ added in v0.34.8
CloseIfTunnelCurrent is CloseIfSignalCurrent for the tunnel.
func (*Node) InJoinGraceWindow ¶ added in v0.34.5
func (*Node) IsTunnelClosed ¶ added in v0.32.0
type P2PConfig ¶ added in v0.34.8
type P2PConfig struct {
// BasePort is the first of the observers' three UDP ports; they listen
// on 0.0.0.0 and, when the host allows it, on ::. 0 lets the kernel
// choose.
BasePort int
// IP is p2p_ip: the addresses (IPs or host names, comma separated)
// announced to the clients; 0.0.0.0 and :: detect the host's IPv4 and
// IPv6 address.
IP string
STUNServers []string // host:port of public STUN servers handed to the clients; empty: none
Timeouts protocol.Timeouts // zero fields take the library defaults
// PortMapping enables the clients' port mapping methods.
PortMapping protocol.PortMappingPolicy
}
P2PConfig configures the bridge's P2P service: the NAT observers and the coordinator that pairs a visitor with a provider.
type SelectMode ¶ added in v0.30.3
type SelectMode int32
const ( Primary SelectMode = iota RoundRobin Random )