Documentation ¶
Index ¶
- Constants
- Variables
- func AbsDiffUint64(left, right uint64) uint64
- type BackingService
- type DistributedConfig
- type DistributedConfigState
- type DummyVif
- type LatencyMeasurementResult
- type LatencyMeasurementState
- type LikeRoutingTable
- func (r *LikeRoutingTable) Delete(prefix [16]byte, prefixLen uint8)
- func (r *LikeRoutingTable) Insert(prefix [16]byte, prefixLen uint8, value interface{}) error
- func (r *LikeRoutingTable) InsertCIDR(repr string, value interface{}) error
- func (r *LikeRoutingTable) Lookup(prefix [16]byte, prefixLen uint8, ...) error
- func (r *LikeRoutingTable) Range(callback func([16]byte, uint8, interface{}) bool)
- type LocalAnnouncement
- type MessageStream
- type MessageTag
- type Node
- func (n *Node) BuildPrintableRoutingTable() string
- func (n *Node) Connect(peer PeerConfig, persist bool) error
- func (n *Node) ConnectToAllPeers()
- func (n *Node) DispatchIPPacket(payload []byte) error
- func (n *Node) GetRouteForAddress(_addr net.IP) (retRouteInfo RouteInfo, retPeer *Peer, retErr error)
- func (n *Node) PersistingConnect(peer PeerConfig, oldError error)
- func (n *Node) ProcessMessageStream(stream MessageStream, peerConfig *PeerConfig) error
- func (n *Node) Run() error
- func (n *Node) UpdateDistributedConfig(dc *protocol.DistributedConfig) error
- type NodeConfig
- type Peer
- type PeerCertCollection
- type PeerConfig
- type PeerID
- type PeerServer
- type PrefixWhitelistEntryProps
- type RouteInfo
- type Tun
- type UDPChannel
- type Vif
- type VifConfig
Constants ¶
View Source
const LatencySampleSize = 10
View Source
const RetryDelay = 10 * time.Second
View Source
const RouteTimeout = 1 * time.Minute
Variables ¶
View Source
var EnableDebug bool = false
Functions ¶
func AbsDiffUint64 ¶
Types ¶
type BackingService ¶
type BackingService struct {
// contains filtered or unexported fields
}
func NewBackingService ¶
func NewBackingService(name string, network, address string) (*BackingService, error)
func (*BackingService) GetName ¶
func (s *BackingService) GetName() string
type DistributedConfig ¶
type DistributedConfigState ¶
type DistributedConfigState struct { sync.Mutex Config *DistributedConfig RawConfig *protocol.DistributedConfig PrefixWhitelistTable map[string]*LikeRoutingTable // typeof value = PrefixWhitelistEntryProps // contains filtered or unexported fields }
func (*DistributedConfigState) PrefixIsWhitelisted ¶
func (s *DistributedConfigState) PrefixIsWhitelisted(name string, prefix [16]byte, prefixLen uint8) bool
type LatencyMeasurementResult ¶
type LatencyMeasurementResult struct {
// contains filtered or unexported fields
}
type LatencyMeasurementState ¶
type LikeRoutingTable ¶
type LikeRoutingTable struct {
Routes [129]sync.Map // prefix_len -> (IPV6 Address ([16]byte) -> interface{})
}
func (*LikeRoutingTable) Delete ¶
func (r *LikeRoutingTable) Delete(prefix [16]byte, prefixLen uint8)
func (*LikeRoutingTable) Insert ¶
func (r *LikeRoutingTable) Insert(prefix [16]byte, prefixLen uint8, value interface{}) error
func (*LikeRoutingTable) InsertCIDR ¶
func (r *LikeRoutingTable) InsertCIDR(repr string, value interface{}) error
type LocalAnnouncement ¶
type MessageStream ¶
type MessageTag ¶
type MessageTag uint32
const ( MessageTag_Invalid MessageTag = iota MessageTag_IP MessageTag_Announce MessageTag_Ping MessageTag_Pong MessageTag_UpdateDistributedConfig MessageTag_ChannelRequest MessageTag_ChannelResponse )
type Node ¶
type Node struct { Config *NodeConfig CAPool *x509.CertPool // Internal CA CA *x509.Certificate PeerCerts PeerCertCollection // External Peers' certificates FullCert tls.Certificate LocalID PeerID Domain string // Values of the `Peers` map can be temporarily nil to indicate a peer is being initialized. Peers sync.Map // PeerID -> *Peer RoutingTable LikeRoutingTable Vifs map[string]Vif DCState DistributedConfigState UDPChannelAddr *net.UDPAddr UDPChannelListener net.PacketConn }
func NewNode ¶
func NewNode(config *NodeConfig) (*Node, error)
func (*Node) BuildPrintableRoutingTable ¶
func (*Node) ConnectToAllPeers ¶
func (n *Node) ConnectToAllPeers()
func (*Node) DispatchIPPacket ¶
func (*Node) GetRouteForAddress ¶
func (*Node) PersistingConnect ¶
func (n *Node) PersistingConnect(peer PeerConfig, oldError error)
func (*Node) ProcessMessageStream ¶
func (n *Node) ProcessMessageStream(stream MessageStream, peerConfig *PeerConfig) error
func (*Node) UpdateDistributedConfig ¶
func (n *Node) UpdateDistributedConfig(dc *protocol.DistributedConfig) error
type NodeConfig ¶
type NodeConfig struct { ListenAddr string `json:"listen_addr"` CAPath string `json:"ca"` ExternalPeerCertPaths []string `json:"external_peer_certs"` CertPath string `json:"cert"` PrivateKeyPath string `json:"private_key"` ServerName string `json:"server_name"` LocalAnnouncements []LocalAnnouncement `json:"local_announcements"` Peers []PeerConfig `json:"peers"` Vifs map[string]VifConfig `json:"vifs"` }
type Peer ¶
type Peer struct { Node *Node LocalCert *x509.Certificate LocalID PeerID RemoteCert *x509.Certificate RemoteID PeerID RemoteName string Out chan<- *protocol.Message // contains filtered or unexported fields }
func (*Peer) GetLatencyMs ¶
func (*Peer) PushLatencyLog ¶
type PeerCertCollection ¶
type PeerCertCollection struct {
Certs map[PeerID]*x509.Certificate
}
type PeerConfig ¶
type PeerServer ¶
type PeerServer struct { protocol.UnimplementedVnetPeerServer // contains filtered or unexported fields }
func (*PeerServer) Input ¶
func (p *PeerServer) Input(server protocol.VnetPeer_InputServer) error
type PrefixWhitelistEntryProps ¶
type PrefixWhitelistEntryProps struct {
MaxPrefixLen uint8
}
func ParsePrefixWhitelistEntry ¶
func ParsePrefixWhitelistEntry(entry string) (string, PrefixWhitelistEntryProps)
type UDPChannel ¶
type UDPChannel struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.