Documentation ¶
Index ¶
- Constants
- func AddCircuitAddrsToPeer(peer *peer.AddrInfo, relayPeers RelayMap) error
- func AppendMultiaddrs(maddrs []ma.Multiaddr, dest ma.Multiaddr) []ma.Multiaddr
- func BootstrapConnect(ctx context.Context, ph p2phost.Host, bootstrapPeers RelayMap) error
- func CreateLimitOpt(config *v1alpha1.TunnelLimitConfig) (libp2p.Option, error)
- func FilterCircuitMaddr(maddrs []ma.Multiaddr) []ma.Multiaddr
- func FilterPrivateMaddr(maddrs []ma.Multiaddr) []ma.Multiaddr
- func GenerateKeyPairWithString(s string) (crypto.PrivKey, error)
- func GenerateMultiAddrString(protocol, ip string, port int) string
- func GeneratePSKReader(path string) (io.Reader, error)
- func GeneratePeerInfo(hostname string, addrs []string) (*peer.AddrInfo, error)
- func GenerateTransportOption(protocol string) libp2p.Option
- func IsNoFindPeerError(err error) bool
- func PeerIDFromString(s string) (peer.ID, error)
- func Register(c *v1alpha1.EdgeTunnelConfig) error
- func StringsToMaddrs(addrStrings []string) (mas []ma.Multiaddr, err error)
- type EdgeTunnel
- type ProxyOptions
- type RelayMap
- type StreamAddr
- type StreamConn
Constants ¶
const ( MaxReadSize = 4096 DailRetryTime = 3 DailSleepTime = 500 * time.Microsecond RetryTime = 3 RetryInterval = 2 * time.Second )
const ( UDP = "udp" TCP = "tcp" Websocket = "ws" Quic = "quic" )
Variables ¶
This section is empty.
Functions ¶
func AddCircuitAddrsToPeer ¶
func AppendMultiaddrs ¶
AppendMultiaddrs append a maddr into maddrs, do nothing if contains
func BootstrapConnect ¶
func CreateLimitOpt ¶ added in v1.13.0
func CreateLimitOpt(config *v1alpha1.TunnelLimitConfig) (libp2p.Option, error)
func GenerateMultiAddrString ¶
GenerateMultiAddrString generate an IPv4 multi-address string by protocol, ip and port supported protocols: ["tcp", "ws", "quic"]
func GeneratePeerInfo ¶
func GenerateTransportOption ¶
func GenerateTransportOption(protocol string) libp2p.Option
GenerateTransportOption generate Transport option from protocol supported protocols: ["tcp", "ws", "quic"]
func IsNoFindPeerError ¶
func Register ¶
func Register(c *v1alpha1.EdgeTunnelConfig) error
Register register EdgeTunnel to beehive modules
Types ¶
type EdgeTunnel ¶
type EdgeTunnel struct { Config *v1alpha1.EdgeTunnelConfig // contains filtered or unexported fields }
EdgeTunnel is used for solving cross subset communication
var Agent *EdgeTunnel
Agent expose the tunnel ability. TODO convert var to func
func (*EdgeTunnel) Enable ¶
func (t *EdgeTunnel) Enable() bool
Enable indicates whether enable this module
func (*EdgeTunnel) GetProxyStream ¶
func (t *EdgeTunnel) GetProxyStream(opts ProxyOptions) (*StreamConn, error)
func (*EdgeTunnel) Run ¶
func (t *EdgeTunnel) Run()
type ProxyOptions ¶
type StreamAddr ¶
type StreamAddr struct {
// contains filtered or unexported fields
}
StreamAddr implements the net.Addr interface
func (*StreamAddr) Network ¶
func (sa *StreamAddr) Network() string
func (*StreamAddr) String ¶
func (sa *StreamAddr) String() string
type StreamConn ¶
StreamConn is libp2p network.Stream wrapper, which implements the Golang net.Conn interface
func NewStreamConn ¶
func NewStreamConn(s network.Stream) *StreamConn
func (*StreamConn) LocalAddr ¶
func (ns *StreamConn) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*StreamConn) RemoteAddr ¶
func (ns *StreamConn) RemoteAddr() net.Addr
RemoteAddr returns the remote network address.