ippool
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
ippool implements IP address storage, creation, and retrieval for cmd/natc
Index¶
- Variables
- type ClusterOpts
- type ConsensusIPPool
- func (ipp *ConsensusIPPool) Apply(lg *raft.Log) any
- func (ipp *ConsensusIPPool) DeleteClusterServer(id raft.ServerID) (uint64, error)
- func (ipp *ConsensusIPPool) DomainForIP(from tailcfg.NodeID, addr netip.Addr, updatedAt time.Time) (string, bool)
- func (ipp *ConsensusIPPool) GetClusterConfiguration() (raft.Configuration, error)
- func (ipp *ConsensusIPPool) IPForDomain(nid tailcfg.NodeID, domain string) (netip.Addr, error)
- func (ipp *ConsensusIPPool) Restore(rc io.ReadCloser) error
- func (ipp *ConsensusIPPool) Snapshot() (raft.FSMSnapshot, error)
- func (ipp *ConsensusIPPool) StartConsensus(ctx context.Context, ts *tsnet.Server, opts ClusterOpts) error
- func (ipp *ConsensusIPPool) StopConsensus(ctx context.Context) error
- type IPPool
- type SingleMachineIPPool
Constants¶
This section is empty.
Variables¶
var ErrNoIPsAvailable =errors.New("no IPs available")Functions¶
This section is empty.
Types¶
typeClusterOpts¶added inv1.88.0
typeConsensusIPPool¶added inv1.86.0
ConsensusIPPool implements anIPPool that is distributed among members of a cluster for high availability.Writes are directed to a leader among the cluster and are slower than reads, reads are performed locallyusing information replicated from the leader.The cluster maintains consistency, reads can be stale and writes can be unavailable if sufficient clusterpeers are unavailable.
funcNewConsensusIPPool¶added inv1.86.0
func NewConsensusIPPool(ipSet *netipx.IPSet) *ConsensusIPPool
func (*ConsensusIPPool)Apply¶added inv1.86.0
func (ipp *ConsensusIPPool) Apply(lg *raft.Log)any
Apply is part of the raft.FSM interface. It takes an incoming log entry and applies it to the state.
func (*ConsensusIPPool)DeleteClusterServer¶added inv1.88.0
func (ipp *ConsensusIPPool) DeleteClusterServer(idraft.ServerID) (uint64,error)
DeleteClusterServer removes a server from the consensus implementation's cluster configuration
func (*ConsensusIPPool)DomainForIP¶added inv1.86.0
func (ipp *ConsensusIPPool) DomainForIP(fromtailcfg.NodeID, addrnetip.Addr, updatedAttime.Time) (string,bool)
DomainForIP looks up the domain associated with a tailcfg.NodeID and netip.Addr pair.If there is no association, the result is empty and ok is false.
func (*ConsensusIPPool)GetClusterConfiguration¶added inv1.88.0
func (ipp *ConsensusIPPool) GetClusterConfiguration() (raft.Configuration,error)
GetClusterConfiguration gets the consensus implementation's cluster configuration
func (*ConsensusIPPool)IPForDomain¶added inv1.86.0
IPForDomain looks up or creates an IP address allocation for the tailcfg.NodeID and domain pair.If no address association is found, one is allocated from the range of free addresses for this tailcfg.NodeID.If no more address are available, an error is returned.
func (*ConsensusIPPool)Restore¶added inv1.86.0
func (ipp *ConsensusIPPool) Restore(rcio.ReadCloser)error
Restore is part of the raft.FSM interface.According to the docs it:
- will not be called concurrently with any other command
- the FSM must discard all previous state before restoring
func (*ConsensusIPPool)Snapshot¶added inv1.86.0
func (ipp *ConsensusIPPool) Snapshot() (raft.FSMSnapshot,error)
Snapshot is part of the raft.FSM interface.According to the docs it:
- should return quickly
- will not be called concurrently with Apply
- the snapshot returned will have Persist called on it concurrently with Apply(so it should not contain pointers to the original data that's being mutated)
func (*ConsensusIPPool)StartConsensus¶added inv1.86.0
func (ipp *ConsensusIPPool) StartConsensus(ctxcontext.Context, ts *tsnet.Server, optsClusterOpts)error
StartConsensus is part of the IPPool interface. It starts the raft background routines that handle consensus.
func (*ConsensusIPPool)StopConsensus¶added inv1.86.0
func (ipp *ConsensusIPPool) StopConsensus(ctxcontext.Context)error
StopConsensus is part of the IPPool interface. It stops the raft background routines that handle consensus.
typeIPPool¶
type IPPool interface {// DomainForIP looks up the domain associated with a tailcfg.NodeID and netip.Addr pair.// If there is no association, the result is empty and ok is false.DomainForIP(tailcfg.NodeID,netip.Addr,time.Time) (string,bool)// IPForDomain looks up or creates an IP address allocation for the tailcfg.NodeID and domain pair.// If no address association is found, one is allocated from the range of free addresses for this tailcfg.NodeID.// If no more address are available, an error is returned.IPForDomain(tailcfg.NodeID,string) (netip.Addr,error)}IPPool allocates IPv4 addresses from a pool to DNS domains, on a per tailcfg.NodeID basis.For each tailcfg.NodeID, IPv4 addresses are associated with at most one DNS domain.Addresses may be reused across other tailcfg.NodeID's for the same or other domains.