router

package
v0.0.0-...-f0ebf03 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelType_undefined = vpn.ChannelType_undefined
	ChannelTypeDirect     = vpn.ChannelTypeDirect
	ChannelTypeIPFS       = vpn.ChannelTypeIPFS
	ChannelTypeTunnel     = vpn.ChannelTypeTunnel
	ChannelTypeAutoRouted = vpn.ChannelTypeAutoRouted
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrInfo

type AddrInfo = network.AddrInfo

type ChannelType

type ChannelType = vpn.ChannelType

type DirectRoute

type DirectRoute struct {
	// contains filtered or unexported fields
}

func (*DirectRoute) ChannelType

func (route *DirectRoute) ChannelType() ChannelType

func (*DirectRoute) Destination

func (route *DirectRoute) Destination() (result net.IP)

func (*DirectRoute) Latency

func (route *DirectRoute) Latency() time.Duration

func (*DirectRoute) MeasureLatency

func (route *DirectRoute) MeasureLatency(ctx context.Context)

func (*DirectRoute) SetDestination

func (route *DirectRoute) SetDestination(ip net.IP)

func (*DirectRoute) TimedOutFraction

func (route *DirectRoute) TimedOutFraction() float64

type Logger

type Logger interface {
	Error(...interface{})
	Infof(string, ...interface{})
	Debugf(string, ...interface{})

	GetDebugWriter() io.Writer
	GetInfoWriter() io.Writer
	GetErrorWriter() io.Writer
}

type PathStatistics

type PathStatistics struct {
	// contains filtered or unexported fields
}

func (*PathStatistics) Consider

func (stats *PathStatistics) Consider(latency time.Duration, isLoss bool)

func (*PathStatistics) Latency

func (stats *PathStatistics) Latency() (result time.Duration)

func (*PathStatistics) LockDo

func (stats *PathStatistics) LockDo(fn func())

func (*PathStatistics) RLockDo

func (stats *PathStatistics) RLockDo(fn func())

func (*PathStatistics) TimedOut

func (stats *PathStatistics) TimedOut() (result float64)

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

func (*Peer) DirectRoutes

func (peer *Peer) DirectRoutes() (result []*DirectRoute)

func (*Peer) ID

func (peer *Peer) ID() PeerID

func (*Peer) IP

func (peer *Peer) IP() (result net.IP)

func (*Peer) LockDo

func (peer *Peer) LockDo(fn func())

func (*Peer) MeasureLatencies

func (peer *Peer) MeasureLatencies(ctx context.Context) context.Context

func (*Peer) RLockDo

func (peer *Peer) RLockDo(fn func())

func (*Peer) SetDirectRoute

func (peer *Peer) SetDirectRoute(chType ChannelType, ip net.IP)

func (*Peer) SetIP

func (peer *Peer) SetIP(newIP net.IP)

func (*Peer) Stream

func (peer *Peer) Stream() (result Stream)

type PeerID

type PeerID = peer.ID

type ReconnectableStream

type ReconnectableStream = helpers.ReconnectableStream

type Router

type Router struct {
	// contains filtered or unexported fields
}

func New

func New(logger Logger) *Router

func (*Router) Close

func (router *Router) Close() error

func (*Router) ConsiderKnownPeer

func (router *Router) ConsiderKnownPeer(peerAddr AddrInfo)

func (*Router) GetPeer

func (router *Router) GetPeer(peerID PeerID) *Peer

func (*Router) IsBadAddress

func (router *Router) IsBadAddress(maddr multiaddr.Multiaddr) bool

func (*Router) NewIncomingStream

func (router *Router) NewIncomingStream(stream Stream, peerAddr AddrInfo)

func (*Router) OnNewRoute

func (router *Router) OnNewRoute(peerID PeerID, chType vpn.ChannelType, ip net.IP)

func (*Router) OnPeerConnect

func (router *Router) OnPeerConnect(peerID PeerID)

func (*Router) OnRemoveRoute

func (router *Router) OnRemoveRoute(peerID PeerID, chType vpn.ChannelType)

func (*Router) OnUpdateMyIP

func (router *Router) OnUpdateMyIP(ip net.IP)

func (*Router) ProtocolID

func (router *Router) ProtocolID() protocol.ID

func (*Router) SetID

func (router *Router) SetID(id PeerID)

func (*Router) SetMyAddrs

func (router *Router) SetMyAddrs(addrs []multiaddr.Multiaddr)

func (*Router) SetNetwork

func (router *Router) SetNetwork(mesh *network.Network)

func (*Router) SetPSK

func (router *Router) SetPSK(psk []byte)

func (*Router) SetPrivateKey

func (router *Router) SetPrivateKey(privKey ed25519.PrivateKey)

func (*Router) Start

func (router *Router) Start() error

type Stream

type Stream = network.Stream

Jump to

Keyboard shortcuts

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