Documentation ¶
Index ¶
- Constants
- func NewUDPAddrFromLH4(ipp *api.Ipv4Addr) *udp.Addr
- func NewUDPAddrFromLH6(ipp *api.Ipv6Addr) *udp.Addr
- type Cache
- type CacheRelay
- type CacheV4
- type CacheV6
- type HostInfo
- type HostMap
- type RemoteList
- func (r *RemoteList) CopyAddrs() []*udp.Addr
- func (r *RemoteList) ForEach(forEach func(addr *udp.Addr))
- func (r *RemoteList) GetCache(name string) *Cache
- func (r *RemoteList) LearnRemote(name string, addr *udp.Addr)
- func (r *RemoteList) Rebuild()
- func (r *RemoteList) ResetBlockedRemotes()
- func (r *RemoteList) UnlockedPrependV4(name string, to *api.Ipv4Addr)
- func (r *RemoteList) UnlockedPrependV6(name string, to *api.Ipv6Addr)
- func (r *RemoteList) UnlockedSetV4(name string, to []*api.Ipv4Addr)
- func (r *RemoteList) UnlockedSetV6(name string, to []*api.Ipv6Addr)
Constants ¶
View Source
const (
MaxRemotes = 10
)
Variables ¶
This section is empty.
Functions ¶
func NewUDPAddrFromLH4 ¶
func NewUDPAddrFromLH6 ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an internal struct that splits v4 and v6 addresses inside the cache map
type CacheRelay ¶
type CacheRelay struct {
// contains filtered or unexported fields
}
func (*CacheRelay) Relay ¶
func (c *CacheRelay) Relay() []uint32
type HostInfo ¶
type HostInfo struct { Remote *udp.Addr Remotes *RemoteList //RemoteIndexId uint32 //LocalIndexId uint32 Name string }
type HostMap ¶
type HostMap struct { sync.RWMutex //Because we concurrently read and write to our maps //Indexes map[uint32]*HostInfo //Relays map[uint32]*HostInfo // Maps a Relay IDX to a Relay HostInfo object //RemoteIndexes map[uint32]*HostInfo Hosts map[string]*HostInfo // contains filtered or unexported fields }
func NewHostMap ¶
type RemoteList ¶
type RemoteList struct { // Every interaction with internals requires a lock! sync.RWMutex // contains filtered or unexported fields }
RemoteList is a unifying concept for lighthouse servers and clients as well as hostinfos. It serves as a local cache of query replies, host update notifications, and locally learned addresses
func NewRemoteList ¶
func NewRemoteList() *RemoteList
func (*RemoteList) CopyAddrs ¶
func (r *RemoteList) CopyAddrs() []*udp.Addr
CopyAddrs locks and makes a deep copy of the deduplicated address list
func (*RemoteList) ForEach ¶
func (r *RemoteList) ForEach(forEach func(addr *udp.Addr))
func (*RemoteList) GetCache ¶
func (r *RemoteList) GetCache(name string) *Cache
func (*RemoteList) LearnRemote ¶
func (r *RemoteList) LearnRemote(name string, addr *udp.Addr)
LearnRemote 锁定并设置拥有者 VPN IP 的已学习地址槽位为提供的 addr。 目前仅在调用 HostInfo.SetRemote 时需要使用,因为该方法应涵盖握手和漫游两种情况。 它将标记去重后的地址列表为脏状态,因此仅在有新信息可用时调用它。 TODO: 需要支持允许列表
func (*RemoteList) Rebuild ¶
func (r *RemoteList) Rebuild()
func (*RemoteList) ResetBlockedRemotes ¶
func (r *RemoteList) ResetBlockedRemotes()
ResetBlockedRemotes 锁定并清除阻止的远程列表
func (*RemoteList) UnlockedPrependV4 ¶
func (r *RemoteList) UnlockedPrependV4(name string, to *api.Ipv4Addr)
func (*RemoteList) UnlockedPrependV6 ¶
func (r *RemoteList) UnlockedPrependV6(name string, to *api.Ipv6Addr)
func (*RemoteList) UnlockedSetV4 ¶
func (r *RemoteList) UnlockedSetV4(name string, to []*api.Ipv4Addr)
func (*RemoteList) UnlockedSetV6 ¶
func (r *RemoteList) UnlockedSetV6(name string, to []*api.Ipv6Addr)
Click to show internal directories.
Click to hide internal directories.