Documentation ¶
Index ¶
- Constants
- Variables
- func AddFirewallRulesFromConfig(inbound bool, config *Config, fw FirewallInterface) error
- func HandleIncomingHandshake(f *Interface, addr *udpAddr, packet []byte, h *Header, hostinfo *HostInfo)
- func HeaderEncode(b []byte, v uint8, t uint8, st uint8, ri uint32, c uint64) []byte
- func Main(configPath string, configTest bool, buildVersion string)
- func NewIpAndPortsFromNetIps(ips []udpAddr) *[]*IpAndPort
- func NewListener(ip string, port int, multi bool) (*udpConn, error)
- func NewUDPAddr(ip uint32, port uint16) *udpAddr
- func NewUDPAddrFromString(s string) *udpAddr
- func PrivateIP(ip net.IP) bool
- func RecombineCertAndValidate(h *noise.HandshakeState, rawCertBytes []byte) (*cert.NebulaCertificate, error)
- func SubTypeName(t NebulaMessageType, s NebulaMessageSubType) string
- func TypeName(t NebulaMessageType) string
- type Bits
- type CIDRNode
- type CIDRTree
- type CertState
- type Config
- func (c *Config) CatchHUP()
- func (c *Config) Get(k string) interface{}
- func (c *Config) GetBool(k string, d bool) bool
- func (c *Config) GetDuration(k string, d time.Duration) time.Duration
- func (c *Config) GetInt(k string, d int) int
- func (c *Config) GetMap(k string, d map[interface{}]interface{}) map[interface{}]interface{}
- func (c *Config) GetString(k, d string) string
- func (c *Config) GetStringSlice(k string, d []string) []string
- func (c *Config) HasChanged(k string) bool
- func (c *Config) Load(path string) error
- func (c *Config) RegisterReloadCallback(f func(*Config))
- func (c *Config) ReloadConfig()
- type ConnectionState
- type EncWriter
- type Firewall
- func (f *Firewall) AddRule(incoming bool, proto uint8, startPort int32, endPort int32, groups []string, ...) error
- func (f *Firewall) Destroy()
- func (f *Firewall) Drop(packet []byte, fp FirewallPacket, incoming bool, h *HostInfo, ...) bool
- func (f *Firewall) EmitStats()
- func (f *Firewall) GetRuleHash() string
- type FirewallCA
- type FirewallInterface
- type FirewallPacket
- type FirewallRule
- type FirewallTable
- type HandshakeManager
- func (c *HandshakeManager) AddIndex(index uint32, ci *ConnectionState) (*HostInfo, error)
- func (c *HandshakeManager) AddIndexHostInfo(index uint32, h *HostInfo)
- func (c *HandshakeManager) AddVpnIP(vpnIP uint32) *HostInfo
- func (c *HandshakeManager) DeleteIndex(index uint32)
- func (c *HandshakeManager) DeleteVpnIP(vpnIP uint32)
- func (c *HandshakeManager) EmitStats()
- func (c *HandshakeManager) NextInboundHandshakeTimerTick(now time.Time)
- func (c *HandshakeManager) NextOutboundHandshakeTimerTick(now time.Time, f EncWriter)
- func (c *HandshakeManager) QueryIndex(index uint32) (*HostInfo, error)
- func (c *HandshakeManager) Run(f EncWriter)
- type Header
- type HostInfo
- func (i *HostInfo) AddRemote(r udpAddr) *udpAddr
- func (i *HostInfo) BindConnectionState(cs *ConnectionState)
- func (i *HostInfo) ClearConnectionState()
- func (i *HostInfo) ClearRemotes()
- func (i *HostInfo) CreateRemoteCIDR(c *cert.NebulaCertificate)
- func (i *HostInfo) ForcePromoteBest(preferredRanges []*net.IPNet)
- func (i *HostInfo) GetCert() *cert.NebulaCertificate
- func (i *HostInfo) MarshalJSON() ([]byte, error)
- func (i *HostInfo) RecvErrorExceeded() bool
- func (i *HostInfo) RemoteUDPAddrs() []*udpAddr
- func (i *HostInfo) SetRemote(remote udpAddr)
- func (i *HostInfo) TryPromoteBest(preferredRanges []*net.IPNet, ifce *Interface)
- type HostInfoDest
- type HostMap
- func (hm *HostMap) Add(ip uint32, hostinfo *HostInfo)
- func (hm *HostMap) AddIndex(index uint32, ci *ConnectionState) (*HostInfo, error)
- func (hm *HostMap) AddIndexHostInfo(index uint32, h *HostInfo)
- func (hm *HostMap) AddRemote(vpnIp uint32, remote *udpAddr) *HostInfo
- func (hm *HostMap) AddVpnIP(vpnIP uint32) *HostInfo
- func (hm *HostMap) AddVpnIPHostInfo(vpnIP uint32, h *HostInfo)
- func (hm *HostMap) CheckHandshakeCompleteIP(vpnIP uint32) bool
- func (hm *HostMap) CheckHandshakeCompleteIndex(index uint32) bool
- func (hm *HostMap) ClearRemotes(vpnIP uint32)
- func (hm *HostMap) DeleteIndex(index uint32)
- func (hm *HostMap) DeleteVpnIP(vpnIP uint32)
- func (hm *HostMap) EmitStats(name string)
- func (hm *HostMap) GetIndexByVpnIP(vpnIP uint32) (uint32, error)
- func (hm *HostMap) GetVpnIPByIndex(index uint32) (uint32, error)
- func (hm *HostMap) PromoteBestQueryVpnIP(vpnIp uint32, ifce *Interface) (*HostInfo, error)
- func (hm *HostMap) PunchList() []*udpAddr
- func (hm *HostMap) Punchy(conn *udpConn)
- func (hm *HostMap) QueryIndex(index uint32) (*HostInfo, error)
- func (hm *HostMap) QueryReverseIndex(index uint32) (*HostInfo, error)
- func (hm *HostMap) QueryVpnIP(vpnIp uint32) (*HostInfo, error)
- func (hm *HostMap) SetDefaultRoute(ip uint32)
- type IntIp
- type Interface
- func (f *Interface) RegisterConfigChangeCallbacks(c *Config)
- func (f *Interface) Run(tunRoutines, udpRoutines int, buildVersion string)
- func (f *Interface) SendMessageToAll(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte)
- func (f *Interface) SendMessageToVpnIp(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte)
- type InterfaceConfig
- type IpAndPort
- func (*IpAndPort) Descriptor() ([]byte, []int)
- func (m *IpAndPort) GetIp() uint32
- func (m *IpAndPort) GetPort() uint32
- func (*IpAndPort) ProtoMessage()
- func (m *IpAndPort) Reset()
- func (m *IpAndPort) String() string
- func (m *IpAndPort) XXX_DiscardUnknown()
- func (m *IpAndPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *IpAndPort) XXX_Merge(src proto.Message)
- func (m *IpAndPort) XXX_Size() int
- func (m *IpAndPort) XXX_Unmarshal(b []byte) error
- type LightHouse
- func (lh *LightHouse) AddRemote(vpnIP uint32, toIp *udpAddr, static bool)
- func (lh *LightHouse) AddRemoteAndReset(vpnIP uint32, toIp *udpAddr)
- func (lh *LightHouse) DeleteVpnIP(vpnIP uint32)
- func (lh *LightHouse) HandleRequest(rAddr *udpAddr, vpnIp uint32, p []byte, c *cert.NebulaCertificate, f EncWriter)
- func (lh *LightHouse) IsLighthouseIP(vpnIP uint32) bool
- func (lh *LightHouse) LhUpdateWorker(f EncWriter)
- func (lh *LightHouse) Query(ip uint32, f EncWriter) ([]udpAddr, error)
- func (lh *LightHouse) QueryCache(ip uint32) []udpAddr
- func (lh *LightHouse) QueryServer(ip uint32, f EncWriter)
- func (lh *LightHouse) ValidateLHStaticEntries() error
- type NebulaCipherState
- type NebulaHandshake
- func (*NebulaHandshake) Descriptor() ([]byte, []int)
- func (m *NebulaHandshake) GetDetails() *NebulaHandshakeDetails
- func (m *NebulaHandshake) GetHmac() []byte
- func (*NebulaHandshake) ProtoMessage()
- func (m *NebulaHandshake) Reset()
- func (m *NebulaHandshake) String() string
- func (m *NebulaHandshake) XXX_DiscardUnknown()
- func (m *NebulaHandshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NebulaHandshake) XXX_Merge(src proto.Message)
- func (m *NebulaHandshake) XXX_Size() int
- func (m *NebulaHandshake) XXX_Unmarshal(b []byte) error
- type NebulaHandshakeDetails
- func (*NebulaHandshakeDetails) Descriptor() ([]byte, []int)
- func (m *NebulaHandshakeDetails) GetCert() []byte
- func (m *NebulaHandshakeDetails) GetCookie() uint64
- func (m *NebulaHandshakeDetails) GetInitiatorIndex() uint32
- func (m *NebulaHandshakeDetails) GetResponderIndex() uint32
- func (m *NebulaHandshakeDetails) GetTime() uint64
- func (*NebulaHandshakeDetails) ProtoMessage()
- func (m *NebulaHandshakeDetails) Reset()
- func (m *NebulaHandshakeDetails) String() string
- func (m *NebulaHandshakeDetails) XXX_DiscardUnknown()
- func (m *NebulaHandshakeDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NebulaHandshakeDetails) XXX_Merge(src proto.Message)
- func (m *NebulaHandshakeDetails) XXX_Size() int
- func (m *NebulaHandshakeDetails) XXX_Unmarshal(b []byte) error
- type NebulaMessageSubType
- type NebulaMessageType
- type NebulaMeta
- func (*NebulaMeta) Descriptor() ([]byte, []int)
- func (m *NebulaMeta) GetDetails() *NebulaMetaDetails
- func (m *NebulaMeta) GetType() NebulaMeta_MessageType
- func (*NebulaMeta) ProtoMessage()
- func (m *NebulaMeta) Reset()
- func (m *NebulaMeta) String() string
- func (m *NebulaMeta) XXX_DiscardUnknown()
- func (m *NebulaMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NebulaMeta) XXX_Merge(src proto.Message)
- func (m *NebulaMeta) XXX_Size() int
- func (m *NebulaMeta) XXX_Unmarshal(b []byte) error
- type NebulaMetaDetails
- func (*NebulaMetaDetails) Descriptor() ([]byte, []int)
- func (m *NebulaMetaDetails) GetCounter() uint32
- func (m *NebulaMetaDetails) GetIpAndPorts() []*IpAndPort
- func (m *NebulaMetaDetails) GetVpnIp() uint32
- func (*NebulaMetaDetails) ProtoMessage()
- func (m *NebulaMetaDetails) Reset()
- func (m *NebulaMetaDetails) String() string
- func (m *NebulaMetaDetails) XXX_DiscardUnknown()
- func (m *NebulaMetaDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NebulaMetaDetails) XXX_Merge(src proto.Message)
- func (m *NebulaMetaDetails) XXX_Size() int
- func (m *NebulaMetaDetails) XXX_Unmarshal(b []byte) error
- type NebulaMeta_MessageType
- type NebulaPing
- func (*NebulaPing) Descriptor() ([]byte, []int)
- func (m *NebulaPing) GetTime() uint64
- func (m *NebulaPing) GetType() NebulaPing_MessageType
- func (*NebulaPing) ProtoMessage()
- func (m *NebulaPing) Reset()
- func (m *NebulaPing) String() string
- func (m *NebulaPing) XXX_DiscardUnknown()
- func (m *NebulaPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NebulaPing) XXX_Merge(src proto.Message)
- func (m *NebulaPing) XXX_Size() int
- func (m *NebulaPing) XXX_Unmarshal(b []byte) error
- type NebulaPing_MessageType
- type Probe
- type SystemTimeoutItem
- type SystemTimeoutList
- type SystemTimerWheel
- type TimeoutItem
- type TimeoutList
- type TimerWheel
- type Tun
Constants ¶
const ( // Total time to try a handshake = sequence of HandshakeTryInterval * HandshakeRetries // With 100ms interval and 20 retries is 23.5 seconds HandshakeTryInterval = time.Millisecond * 100 HandshakeRetries = 20 // HandshakeWaitRotation is the number of handshake attempts to do before starting to use other ips addresses HandshakeWaitRotation = 5 )
const ( Version uint8 = 1 HeaderLen = 16 )
const DEFAULT_MTU = 1300
const MaxRemotes = 10
const PromoteEvery = 1000
const ProbeLen = 100
const ReplayWindow = 1024
const RoamingSupressSeconds = 2
How long we should prevent roaming back to the previous IP. This helps prevent flapping due to packets already in flight
Variables ¶
var NebulaMeta_MessageType_name = map[int32]string{
0: "None",
1: "HostQuery",
2: "HostQueryReply",
3: "HostUpdateNotification",
4: "HostMovedNotification",
5: "HostPunchNotification",
6: "HostWhoami",
7: "HostWhoamiReply",
8: "PathCheck",
9: "PathCheckReply",
}
var NebulaMeta_MessageType_value = map[string]int32{
"None": 0,
"HostQuery": 1,
"HostQueryReply": 2,
"HostUpdateNotification": 3,
"HostMovedNotification": 4,
"HostPunchNotification": 5,
"HostWhoami": 6,
"HostWhoamiReply": 7,
"PathCheck": 8,
"PathCheckReply": 9,
}
var NebulaPing_MessageType_name = map[int32]string{
0: "Ping",
1: "Reply",
}
var NebulaPing_MessageType_value = map[string]int32{
"Ping": 0,
"Reply": 1,
}
Functions ¶
func AddFirewallRulesFromConfig ¶
func AddFirewallRulesFromConfig(inbound bool, config *Config, fw FirewallInterface) error
func HandleIncomingHandshake ¶
func HeaderEncode ¶
HeaderEncode uses the provided byte array to encode the provided header values into. Byte array must be capped higher than HeaderLen or this will panic
func NewIpAndPortsFromNetIps ¶
func NewIpAndPortsFromNetIps(ips []udpAddr) *[]*IpAndPort
func NewUDPAddr ¶
func NewUDPAddrFromString ¶
func NewUDPAddrFromString(s string) *udpAddr
func RecombineCertAndValidate ¶
func RecombineCertAndValidate(h *noise.HandshakeState, rawCertBytes []byte) (*cert.NebulaCertificate, error)
func SubTypeName ¶
func SubTypeName(t NebulaMessageType, s NebulaMessageSubType) string
SubTypeName will transform a nebula message sub type into a human string
func TypeName ¶
func TypeName(t NebulaMessageType) string
TypeName will transform a nebula message type into a human string
Types ¶
type CIDRTree ¶
type CIDRTree struct {
// contains filtered or unexported fields
}
func NewCIDRTree ¶
func NewCIDRTree() *CIDRTree
func (*CIDRTree) MostSpecificContains ¶ added in v1.1.0
Finds the most specific match
type CertState ¶
type CertState struct {
// contains filtered or unexported fields
}
func NewCertState ¶
func NewCertState(certificate *cert.NebulaCertificate, privateKey []byte) (*CertState, error)
func NewCertStateFromConfig ¶
type Config ¶
type Config struct { Settings map[interface{}]interface{} // contains filtered or unexported fields }
func (*Config) CatchHUP ¶
func (c *Config) CatchHUP()
CatchHUP will listen for the HUP signal in a go routine and reload all configs found in the original path provided to Load. The old settings are shallow copied for change detection after the reload.
func (*Config) GetBool ¶
GetBool will get the bool for k or return the default d if not found or invalid
func (*Config) GetDuration ¶
GetDuration will get the duration for k or return the default d if not found or invalid
func (*Config) GetInt ¶
GetInt will get the int for k or return the default d if not found or invalid
func (*Config) GetMap ¶
GetMap will get the map for k or return the default d if not found or invalid
func (*Config) GetString ¶
GetString will get the string for k or return the default d if not found or invalid
func (*Config) GetStringSlice ¶
GetStringSlice will get the slice of strings for k or return the default d if not found or invalid
func (*Config) HasChanged ¶
HasChanged checks if the underlying structure of the provided key has changed after a config reload. The value of k in both the old and new settings will be serialized, the result of the string comparison is returned. If k is an empty string the entire config is tested. It's important to note that this is very rudimentary and susceptible to configuration ordering issues indicating there is change when there actually wasn't any.
func (*Config) RegisterReloadCallback ¶
RegisterReloadCallback stores a function to be called when a config reload is triggered. The functions registered here should decide if they need to make a change to the current process before making the change. HasChanged can be used to help decide if a change is necessary. These functions should return quickly or spawn their own go routine if they will take a while
func (*Config) ReloadConfig ¶
func (c *Config) ReloadConfig()
type ConnectionState ¶
type ConnectionState struct { H *noise.HandshakeState // contains filtered or unexported fields }
func (*ConnectionState) MarshalJSON ¶
func (cs *ConnectionState) MarshalJSON() ([]byte, error)
type EncWriter ¶
type EncWriter interface { SendMessageToVpnIp(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte) SendMessageToAll(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte) }
type Firewall ¶
type Firewall struct { Conns map[FirewallPacket]*conn InRules *FirewallTable OutRules *FirewallTable //TODO: we should have many more options for TCP, an option for ICMP, and mimic the kernel a bit better // https://www.kernel.org/doc/Documentation/networking/nf_conntrack-sysctl.txt TCPTimeout time.Duration //linux: 5 days max UDPTimeout time.Duration //linux: 180s max DefaultTimeout time.Duration //linux: 600s TimerWheel *TimerWheel // contains filtered or unexported fields }
TODO: need conntrack max tracked connections handling
func NewFirewall ¶
func NewFirewall(tcpTimeout, UDPTimeout, defaultTimeout time.Duration, c *cert.NebulaCertificate) *Firewall
NewFirewall creates a new Firewall object. A TimerWheel is created for you from the provided timeouts.
func NewFirewallFromConfig ¶
func NewFirewallFromConfig(nc *cert.NebulaCertificate, c *Config) (*Firewall, error)
func (*Firewall) AddRule ¶
func (f *Firewall) AddRule(incoming bool, proto uint8, startPort int32, endPort int32, groups []string, host string, ip *net.IPNet, caName string, caSha string) error
AddRule properly creates the in memory rule structure for a firewall table.
func (*Firewall) Destroy ¶
func (f *Firewall) Destroy()
Destroy cleans up any known cyclical references so the object can be free'd my GC. This should be called if a new firewall object is created
func (*Firewall) Drop ¶
func (f *Firewall) Drop(packet []byte, fp FirewallPacket, incoming bool, h *HostInfo, caPool *cert.NebulaCAPool) bool
func (*Firewall) GetRuleHash ¶
GetRuleHash returns a hash representation of all inbound and outbound rules
type FirewallCA ¶ added in v1.1.0
type FirewallCA struct { Any *FirewallRule CANames map[string]*FirewallRule CAShas map[string]*FirewallRule }
type FirewallInterface ¶
type FirewallPacket ¶
type FirewallPacket struct { LocalIP uint32 RemoteIP uint32 LocalPort uint16 RemotePort uint16 Protocol uint8 Fragment bool }
func (*FirewallPacket) Copy ¶
func (fp *FirewallPacket) Copy() *FirewallPacket
func (FirewallPacket) MarshalJSON ¶
func (fp FirewallPacket) MarshalJSON() ([]byte, error)
type FirewallRule ¶
type FirewallTable ¶
type FirewallTable struct { TCP firewallPort UDP firewallPort ICMP firewallPort AnyProto firewallPort }
type HandshakeManager ¶
type HandshakeManager struct { OutboundHandshakeTimer *SystemTimerWheel InboundHandshakeTimer *SystemTimerWheel // contains filtered or unexported fields }
func NewHandshakeManager ¶
func NewHandshakeManager(tunCidr *net.IPNet, preferredRanges []*net.IPNet, mainHostMap *HostMap, lightHouse *LightHouse, outside *udpConn) *HandshakeManager
func (*HandshakeManager) AddIndex ¶
func (c *HandshakeManager) AddIndex(index uint32, ci *ConnectionState) (*HostInfo, error)
func (*HandshakeManager) AddIndexHostInfo ¶
func (c *HandshakeManager) AddIndexHostInfo(index uint32, h *HostInfo)
func (*HandshakeManager) AddVpnIP ¶
func (c *HandshakeManager) AddVpnIP(vpnIP uint32) *HostInfo
func (*HandshakeManager) DeleteIndex ¶
func (c *HandshakeManager) DeleteIndex(index uint32)
func (*HandshakeManager) DeleteVpnIP ¶
func (c *HandshakeManager) DeleteVpnIP(vpnIP uint32)
func (*HandshakeManager) EmitStats ¶
func (c *HandshakeManager) EmitStats()
func (*HandshakeManager) NextInboundHandshakeTimerTick ¶
func (c *HandshakeManager) NextInboundHandshakeTimerTick(now time.Time)
func (*HandshakeManager) NextOutboundHandshakeTimerTick ¶
func (c *HandshakeManager) NextOutboundHandshakeTimerTick(now time.Time, f EncWriter)
func (*HandshakeManager) QueryIndex ¶
func (c *HandshakeManager) QueryIndex(index uint32) (*HostInfo, error)
func (*HandshakeManager) Run ¶
func (c *HandshakeManager) Run(f EncWriter)
type Header ¶
type Header struct { Version uint8 Type NebulaMessageType Subtype NebulaMessageSubType Reserved uint16 RemoteIndex uint32 MessageCounter uint64 }
func (*Header) MarshalJSON ¶
MarshalJSON creates a json string representation of a header
func (*Header) SubTypeName ¶
SubTypeName will transform the headers message sub type into a human string
type HostInfo ¶
type HostInfo struct { Remotes []*HostInfoDest ConnectionState *ConnectionState HandshakeReady bool HandshakeCounter int HandshakeComplete bool HandshakePacket map[uint8][]byte // contains filtered or unexported fields }
func (*HostInfo) BindConnectionState ¶
func (i *HostInfo) BindConnectionState(cs *ConnectionState)
func (*HostInfo) ClearConnectionState ¶
func (i *HostInfo) ClearConnectionState()
func (*HostInfo) ClearRemotes ¶
func (i *HostInfo) ClearRemotes()
func (*HostInfo) CreateRemoteCIDR ¶ added in v1.1.0
func (i *HostInfo) CreateRemoteCIDR(c *cert.NebulaCertificate)
func (*HostInfo) ForcePromoteBest ¶
func (*HostInfo) GetCert ¶
func (i *HostInfo) GetCert() *cert.NebulaCertificate
func (*HostInfo) MarshalJSON ¶
func (*HostInfo) RecvErrorExceeded ¶
func (*HostInfo) RemoteUDPAddrs ¶
func (i *HostInfo) RemoteUDPAddrs() []*udpAddr
type HostInfoDest ¶
type HostInfoDest struct {
// contains filtered or unexported fields
}
func NewHostInfoDest ¶
func NewHostInfoDest(addr *udpAddr) *HostInfoDest
func (*HostInfoDest) MarshalJSON ¶
func (hid *HostInfoDest) MarshalJSON() ([]byte, error)
type HostMap ¶
type HostMap struct { sync.RWMutex //Because we concurrently read and write to our maps Indexes map[uint32]*HostInfo Hosts map[uint32]*HostInfo // contains filtered or unexported fields }
func NewHostMap ¶
func (*HostMap) AddIndex ¶
func (hm *HostMap) AddIndex(index uint32, ci *ConnectionState) (*HostInfo, error)
func (*HostMap) AddIndexHostInfo ¶
func (*HostMap) AddVpnIPHostInfo ¶
func (*HostMap) CheckHandshakeCompleteIP ¶
func (*HostMap) CheckHandshakeCompleteIndex ¶
func (*HostMap) ClearRemotes ¶
func (*HostMap) DeleteIndex ¶
func (*HostMap) DeleteVpnIP ¶
func (*HostMap) EmitStats ¶
UpdateStats takes a name and reports host and index counts to the stats collection system
func (*HostMap) PromoteBestQueryVpnIP ¶
PromoteBestQueryVpnIP will attempt to lazily switch to the best remote every `PromoteEvery` calls to this function for a given host.
func (*HostMap) QueryReverseIndex ¶
This function needs to range because we don't keep a map of remote indexes.
func (*HostMap) SetDefaultRoute ¶
type IntIp ¶
type IntIp uint32
A helper type to avoid converting to IP when logging
func (IntIp) MarshalJSON ¶
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
func NewInterface ¶
func NewInterface(c *InterfaceConfig) (*Interface, error)
func (*Interface) RegisterConfigChangeCallbacks ¶
func (*Interface) SendMessageToAll ¶
func (f *Interface) SendMessageToAll(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte)
SendMessageToAll handles real ip:port lookup and sends to all known addresses for vpnIp
func (*Interface) SendMessageToVpnIp ¶
func (f *Interface) SendMessageToVpnIp(t NebulaMessageType, st NebulaMessageSubType, vpnIp uint32, p, nb, out []byte)
SendMessageToVpnIp handles real ip:port lookup and sends to the current best known address for vpnIp
type InterfaceConfig ¶
type IpAndPort ¶
type IpAndPort struct { Ip uint32 `protobuf:"varint,1,opt,name=Ip,json=ip,proto3" json:"Ip,omitempty"` Port uint32 `protobuf:"varint,2,opt,name=Port,json=port,proto3" json:"Port,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func NewIpAndPortFromUDPAddr ¶
func NewIpAndPortFromUDPAddr(addr udpAddr) *IpAndPort
func (*IpAndPort) Descriptor ¶
func (*IpAndPort) ProtoMessage ¶
func (*IpAndPort) ProtoMessage()
func (*IpAndPort) XXX_DiscardUnknown ¶
func (m *IpAndPort) XXX_DiscardUnknown()
func (*IpAndPort) XXX_Marshal ¶
func (*IpAndPort) XXX_Unmarshal ¶
type LightHouse ¶
type LightHouse struct { sync.RWMutex //Because we concurrently read and write to our maps // contains filtered or unexported fields }
func NewLightHouse ¶
func (*LightHouse) AddRemote ¶
func (lh *LightHouse) AddRemote(vpnIP uint32, toIp *udpAddr, static bool)
func (*LightHouse) AddRemoteAndReset ¶
func (lh *LightHouse) AddRemoteAndReset(vpnIP uint32, toIp *udpAddr)
func (*LightHouse) DeleteVpnIP ¶
func (lh *LightHouse) DeleteVpnIP(vpnIP uint32)
func (*LightHouse) HandleRequest ¶
func (lh *LightHouse) HandleRequest(rAddr *udpAddr, vpnIp uint32, p []byte, c *cert.NebulaCertificate, f EncWriter)
func (*LightHouse) IsLighthouseIP ¶
func (lh *LightHouse) IsLighthouseIP(vpnIP uint32) bool
func (*LightHouse) LhUpdateWorker ¶
func (lh *LightHouse) LhUpdateWorker(f EncWriter)
func (*LightHouse) QueryCache ¶
func (lh *LightHouse) QueryCache(ip uint32) []udpAddr
Query our local lighthouse cached results
func (*LightHouse) QueryServer ¶
func (lh *LightHouse) QueryServer(ip uint32, f EncWriter)
This is asynchronous so no reply should be expected
func (*LightHouse) ValidateLHStaticEntries ¶ added in v1.1.0
func (lh *LightHouse) ValidateLHStaticEntries() error
type NebulaCipherState ¶
type NebulaCipherState struct {
// contains filtered or unexported fields
}
func NewNebulaCipherState ¶
func NewNebulaCipherState(s *noise.CipherState) *NebulaCipherState
func (*NebulaCipherState) DecryptDanger ¶
func (*NebulaCipherState) EncryptDanger ¶
type NebulaHandshake ¶
type NebulaHandshake struct { Details *NebulaHandshakeDetails `protobuf:"bytes,1,opt,name=Details,json=details,proto3" json:"Details,omitempty"` Hmac []byte `protobuf:"bytes,2,opt,name=Hmac,json=hmac,proto3" json:"Hmac,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NebulaHandshake) Descriptor ¶
func (*NebulaHandshake) Descriptor() ([]byte, []int)
func (*NebulaHandshake) GetDetails ¶
func (m *NebulaHandshake) GetDetails() *NebulaHandshakeDetails
func (*NebulaHandshake) GetHmac ¶
func (m *NebulaHandshake) GetHmac() []byte
func (*NebulaHandshake) ProtoMessage ¶
func (*NebulaHandshake) ProtoMessage()
func (*NebulaHandshake) Reset ¶
func (m *NebulaHandshake) Reset()
func (*NebulaHandshake) String ¶
func (m *NebulaHandshake) String() string
func (*NebulaHandshake) XXX_DiscardUnknown ¶
func (m *NebulaHandshake) XXX_DiscardUnknown()
func (*NebulaHandshake) XXX_Marshal ¶
func (m *NebulaHandshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NebulaHandshake) XXX_Merge ¶
func (m *NebulaHandshake) XXX_Merge(src proto.Message)
func (*NebulaHandshake) XXX_Size ¶
func (m *NebulaHandshake) XXX_Size() int
func (*NebulaHandshake) XXX_Unmarshal ¶
func (m *NebulaHandshake) XXX_Unmarshal(b []byte) error
type NebulaHandshakeDetails ¶
type NebulaHandshakeDetails struct { Cert []byte `protobuf:"bytes,1,opt,name=Cert,json=cert,proto3" json:"Cert,omitempty"` InitiatorIndex uint32 `protobuf:"varint,2,opt,name=InitiatorIndex,json=initiatorIndex,proto3" json:"InitiatorIndex,omitempty"` ResponderIndex uint32 `protobuf:"varint,3,opt,name=ResponderIndex,json=responderIndex,proto3" json:"ResponderIndex,omitempty"` Cookie uint64 `protobuf:"varint,4,opt,name=Cookie,json=cookie,proto3" json:"Cookie,omitempty"` Time uint64 `protobuf:"varint,5,opt,name=Time,json=time,proto3" json:"Time,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NebulaHandshakeDetails) Descriptor ¶
func (*NebulaHandshakeDetails) Descriptor() ([]byte, []int)
func (*NebulaHandshakeDetails) GetCert ¶
func (m *NebulaHandshakeDetails) GetCert() []byte
func (*NebulaHandshakeDetails) GetCookie ¶
func (m *NebulaHandshakeDetails) GetCookie() uint64
func (*NebulaHandshakeDetails) GetInitiatorIndex ¶
func (m *NebulaHandshakeDetails) GetInitiatorIndex() uint32
func (*NebulaHandshakeDetails) GetResponderIndex ¶
func (m *NebulaHandshakeDetails) GetResponderIndex() uint32
func (*NebulaHandshakeDetails) GetTime ¶
func (m *NebulaHandshakeDetails) GetTime() uint64
func (*NebulaHandshakeDetails) ProtoMessage ¶
func (*NebulaHandshakeDetails) ProtoMessage()
func (*NebulaHandshakeDetails) Reset ¶
func (m *NebulaHandshakeDetails) Reset()
func (*NebulaHandshakeDetails) String ¶
func (m *NebulaHandshakeDetails) String() string
func (*NebulaHandshakeDetails) XXX_DiscardUnknown ¶
func (m *NebulaHandshakeDetails) XXX_DiscardUnknown()
func (*NebulaHandshakeDetails) XXX_Marshal ¶
func (m *NebulaHandshakeDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NebulaHandshakeDetails) XXX_Merge ¶
func (m *NebulaHandshakeDetails) XXX_Merge(src proto.Message)
func (*NebulaHandshakeDetails) XXX_Size ¶
func (m *NebulaHandshakeDetails) XXX_Size() int
func (*NebulaHandshakeDetails) XXX_Unmarshal ¶
func (m *NebulaHandshakeDetails) XXX_Unmarshal(b []byte) error
type NebulaMessageSubType ¶
type NebulaMessageSubType uint8
type NebulaMessageType ¶
type NebulaMessageType uint8
type NebulaMeta ¶
type NebulaMeta struct { Type NebulaMeta_MessageType `protobuf:"varint,1,opt,name=Type,json=type,proto3,enum=nebula.NebulaMeta_MessageType" json:"Type,omitempty"` Details *NebulaMetaDetails `protobuf:"bytes,2,opt,name=Details,json=details,proto3" json:"Details,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func NewLhQueryByInt ¶
func NewLhQueryByInt(VpnIp uint32) *NebulaMeta
func NewLhQueryByIpString ¶
func NewLhQueryByIpString(VpnIp string) *NebulaMeta
func NewLhWhoami ¶
func NewLhWhoami() *NebulaMeta
func (*NebulaMeta) Descriptor ¶
func (*NebulaMeta) Descriptor() ([]byte, []int)
func (*NebulaMeta) GetDetails ¶
func (m *NebulaMeta) GetDetails() *NebulaMetaDetails
func (*NebulaMeta) GetType ¶
func (m *NebulaMeta) GetType() NebulaMeta_MessageType
func (*NebulaMeta) ProtoMessage ¶
func (*NebulaMeta) ProtoMessage()
func (*NebulaMeta) Reset ¶
func (m *NebulaMeta) Reset()
func (*NebulaMeta) String ¶
func (m *NebulaMeta) String() string
func (*NebulaMeta) XXX_DiscardUnknown ¶
func (m *NebulaMeta) XXX_DiscardUnknown()
func (*NebulaMeta) XXX_Marshal ¶
func (m *NebulaMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NebulaMeta) XXX_Merge ¶
func (m *NebulaMeta) XXX_Merge(src proto.Message)
func (*NebulaMeta) XXX_Size ¶
func (m *NebulaMeta) XXX_Size() int
func (*NebulaMeta) XXX_Unmarshal ¶
func (m *NebulaMeta) XXX_Unmarshal(b []byte) error
type NebulaMetaDetails ¶
type NebulaMetaDetails struct { VpnIp uint32 `protobuf:"varint,1,opt,name=VpnIp,json=vpnIp,proto3" json:"VpnIp,omitempty"` IpAndPorts []*IpAndPort `protobuf:"bytes,2,rep,name=IpAndPorts,json=ipAndPorts,proto3" json:"IpAndPorts,omitempty"` Counter uint32 `protobuf:"varint,3,opt,name=counter,proto3" json:"counter,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NebulaMetaDetails) Descriptor ¶
func (*NebulaMetaDetails) Descriptor() ([]byte, []int)
func (*NebulaMetaDetails) GetCounter ¶
func (m *NebulaMetaDetails) GetCounter() uint32
func (*NebulaMetaDetails) GetIpAndPorts ¶
func (m *NebulaMetaDetails) GetIpAndPorts() []*IpAndPort
func (*NebulaMetaDetails) GetVpnIp ¶
func (m *NebulaMetaDetails) GetVpnIp() uint32
func (*NebulaMetaDetails) ProtoMessage ¶
func (*NebulaMetaDetails) ProtoMessage()
func (*NebulaMetaDetails) Reset ¶
func (m *NebulaMetaDetails) Reset()
func (*NebulaMetaDetails) String ¶
func (m *NebulaMetaDetails) String() string
func (*NebulaMetaDetails) XXX_DiscardUnknown ¶
func (m *NebulaMetaDetails) XXX_DiscardUnknown()
func (*NebulaMetaDetails) XXX_Marshal ¶
func (m *NebulaMetaDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NebulaMetaDetails) XXX_Merge ¶
func (m *NebulaMetaDetails) XXX_Merge(src proto.Message)
func (*NebulaMetaDetails) XXX_Size ¶
func (m *NebulaMetaDetails) XXX_Size() int
func (*NebulaMetaDetails) XXX_Unmarshal ¶
func (m *NebulaMetaDetails) XXX_Unmarshal(b []byte) error
type NebulaMeta_MessageType ¶
type NebulaMeta_MessageType int32
const ( NebulaMeta_None NebulaMeta_MessageType = 0 NebulaMeta_HostQuery NebulaMeta_MessageType = 1 NebulaMeta_HostQueryReply NebulaMeta_MessageType = 2 NebulaMeta_HostUpdateNotification NebulaMeta_MessageType = 3 NebulaMeta_HostMovedNotification NebulaMeta_MessageType = 4 NebulaMeta_HostPunchNotification NebulaMeta_MessageType = 5 NebulaMeta_HostWhoami NebulaMeta_MessageType = 6 NebulaMeta_HostWhoamiReply NebulaMeta_MessageType = 7 NebulaMeta_PathCheck NebulaMeta_MessageType = 8 NebulaMeta_PathCheckReply NebulaMeta_MessageType = 9 )
func (NebulaMeta_MessageType) EnumDescriptor ¶
func (NebulaMeta_MessageType) EnumDescriptor() ([]byte, []int)
func (NebulaMeta_MessageType) String ¶
func (x NebulaMeta_MessageType) String() string
type NebulaPing ¶
type NebulaPing struct { Type NebulaPing_MessageType `protobuf:"varint,1,opt,name=Type,json=type,proto3,enum=nebula.NebulaPing_MessageType" json:"Type,omitempty"` Time uint64 `protobuf:"varint,2,opt,name=Time,json=time,proto3" json:"Time,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*NebulaPing) Descriptor ¶
func (*NebulaPing) Descriptor() ([]byte, []int)
func (*NebulaPing) GetTime ¶
func (m *NebulaPing) GetTime() uint64
func (*NebulaPing) GetType ¶
func (m *NebulaPing) GetType() NebulaPing_MessageType
func (*NebulaPing) ProtoMessage ¶
func (*NebulaPing) ProtoMessage()
func (*NebulaPing) Reset ¶
func (m *NebulaPing) Reset()
func (*NebulaPing) String ¶
func (m *NebulaPing) String() string
func (*NebulaPing) XXX_DiscardUnknown ¶
func (m *NebulaPing) XXX_DiscardUnknown()
func (*NebulaPing) XXX_Marshal ¶
func (m *NebulaPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NebulaPing) XXX_Merge ¶
func (m *NebulaPing) XXX_Merge(src proto.Message)
func (*NebulaPing) XXX_Size ¶
func (m *NebulaPing) XXX_Size() int
func (*NebulaPing) XXX_Unmarshal ¶
func (m *NebulaPing) XXX_Unmarshal(b []byte) error
type NebulaPing_MessageType ¶
type NebulaPing_MessageType int32
const ( NebulaPing_Ping NebulaPing_MessageType = 0 NebulaPing_Reply NebulaPing_MessageType = 1 )
func (NebulaPing_MessageType) EnumDescriptor ¶
func (NebulaPing_MessageType) EnumDescriptor() ([]byte, []int)
func (NebulaPing_MessageType) String ¶
func (x NebulaPing_MessageType) String() string
type SystemTimeoutItem ¶
type SystemTimeoutItem struct { Item uint32 Next *SystemTimeoutItem }
Represents an item within a tick
type SystemTimeoutList ¶
type SystemTimeoutList struct { Head *SystemTimeoutItem Tail *SystemTimeoutItem }
Represents a tick in the wheel
type SystemTimerWheel ¶
type SystemTimerWheel struct {
// contains filtered or unexported fields
}
func NewSystemTimerWheel ¶
func NewSystemTimerWheel(min, max time.Duration) *SystemTimerWheel
Builds a timer wheel and identifies the tick duration and wheel duration from the provided values Purge must be called once per entry to actually remove anything
func (*SystemTimerWheel) Add ¶
func (tw *SystemTimerWheel) Add(v uint32, timeout time.Duration) *SystemTimeoutItem
func (*SystemTimerWheel) Purge ¶
func (tw *SystemTimerWheel) Purge() interface{}
type TimeoutItem ¶
type TimeoutItem struct { Packet FirewallPacket Next *TimeoutItem }
Represents an item within a tick
type TimeoutList ¶
type TimeoutList struct { Head *TimeoutItem Tail *TimeoutItem }
Represents a tick in the wheel
type TimerWheel ¶
type TimerWheel struct {
// contains filtered or unexported fields
}
func NewTimerWheel ¶
func NewTimerWheel(min, max time.Duration) *TimerWheel
Builds a timer wheel and identifies the tick duration and wheel duration from the provided values Purge must be called once per entry to actually remove anything
func (*TimerWheel) Add ¶
func (tw *TimerWheel) Add(v FirewallPacket, timeout time.Duration) *TimeoutItem
Add will add a FirewallPacket to the wheel in it's proper timeout
func (*TimerWheel) Purge ¶
func (tw *TimerWheel) Purge() (FirewallPacket, bool)
Source Files ¶
- bits.go
- cert.go
- cidr_radix.go
- config.go
- connection_manager.go
- connection_state.go
- dns_server.go
- firewall.go
- handshake.go
- handshake_ix.go
- handshake_manager.go
- header.go
- hostmap.go
- inside.go
- interface.go
- lighthouse.go
- main.go
- metadata.go
- nebula.pb.go
- noise.go
- outside.go
- ssh.go
- stats.go
- timeout.go
- timeout_system.go
- tun_common.go
- tun_linux.go
- udp_linux.go
- udp_linux_64.go