Documentation
¶
Index ¶
- Constants
- type Client
- func (p *Client) Connect(ctx context.Context, nodes []config.NodeConfig) error
- func (d *Client) Dial(ctx context.Context, peerID peer.ID, addr string) (net.Conn, error)
- func (d *Client) DialByStrategy(ctx context.Context, addr string) (net.Conn, error)
- func (d *Client) DialFastest(ctx context.Context, addr string) (net.Conn, error)
- func (d *Client) DialRandom(ctx context.Context, addr string) (net.Conn, error)
- func (d *Client) DialRoundRobin(ctx context.Context, addr string) (net.Conn, error)
- func (d *Client) Ping(ctx context.Context, conn *Connection) (time.Duration, error)
- type Connection
- type Pool
- func (p *Pool) Add(peerID peer.ID, addr string)
- func (p *Pool) All() []*Connection
- func (p *Pool) Clear()
- func (p *Pool) GetStrategy() PoolStrategy
- func (p *Pool) Remove(peerID peer.ID)
- func (p *Pool) SelectByStrategy(strategy PoolStrategy) *Connection
- func (p *Pool) SelectFastest() *Connection
- func (p *Pool) SelectRandom() *Connection
- func (p *Pool) SelectRoundRobin() *Connection
- func (p *Pool) SetStrategy(s PoolStrategy)
- func (p *Pool) Size() int
- func (p *Pool) UpdateLatency(peerID peer.ID, latency time.Duration)
- type PoolStrategy
- type ProxyResponse
- type Request
- type Server
Constants ¶
View Source
const ( ProxyProtocolID = protocol.ID("/bethrou/proxy/1.0.0") PingProtocolID = protocol.ID("/bethrou/ping/1.0.0") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is the client-side proxy dialer that connects to exit nodes
func (*Client) DialByStrategy ¶
DialByStrategy dials an exit node based on the pool's current strategy.
func (*Client) DialFastest ¶
func (*Client) DialRandom ¶
func (*Client) DialRoundRobin ¶
type Connection ¶
Connection represents a connection to a proxy node
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewPool ¶
func NewPool(strategy PoolStrategy) *Pool
func (*Pool) All ¶
func (p *Pool) All() []*Connection
func (*Pool) GetStrategy ¶
func (p *Pool) GetStrategy() PoolStrategy
func (*Pool) SelectByStrategy ¶
func (p *Pool) SelectByStrategy(strategy PoolStrategy) *Connection
func (*Pool) SelectFastest ¶
func (p *Pool) SelectFastest() *Connection
func (*Pool) SelectRandom ¶
func (p *Pool) SelectRandom() *Connection
func (*Pool) SelectRoundRobin ¶
func (p *Pool) SelectRoundRobin() *Connection
func (*Pool) SetStrategy ¶
func (p *Pool) SetStrategy(s PoolStrategy)
type PoolStrategy ¶
type PoolStrategy string
const ( RandomStrategy PoolStrategy = "random" FastestStrategy PoolStrategy = "latency" RoundRobinStrategy PoolStrategy = "round-robin" )
type ProxyResponse ¶
Click to show internal directories.
Click to hide internal directories.