Versions in this module Expand all Collapse all v0 v0.1.0 Dec 23, 2019 Changes in this version + type Family int + const DualStack + const IPv4 + const IPv6 + func (i Family) String() string + type HTTPHandler struct + func NewHTTPHandler(usePrometheus, usePProf bool, reg *prometheus.Registry, ...) *HTTPHandler + func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Handler struct + IPs IPAllocator + LeaseDuration time.Duration + Leases LeaseStore + Log *log.Logger + Metrics *HandlerMetrics + NewRequest func(src net.Addr) + func (h *Handler) RequestIP(src net.Addr, req *wgdynamic.RequestIP) (*wgdynamic.RequestIP, error) + type HandlerMetrics struct + ErrorsTotal *prometheus.CounterVec + RequestsTotal *prometheus.CounterVec + func NewHandlerMetrics(reg *prometheus.Registry, ifi string) *HandlerMetrics + type IPAllocator interface + Allocate func(family Family) (ips []*net.IPNet, ok bool, err error) + Free func(ip *net.IPNet) error + func DualStackIPAllocator(store IPStore, subnets []Subnet) (IPAllocator, error) + func SimpleIPAllocator(store IPStore, subnet Subnet) (IPAllocator, error) + type IPStore interface + AllocateIP func(subnet, ip *net.IPNet) (ok bool, err error) + AllocatedIPs func(subnet *net.IPNet) (ips []*net.IPNet, err error) + FreeIP func(subnet, ip *net.IPNet) error + SaveSubnet func(subnet *net.IPNet) error + Subnets func() (subnets []*net.IPNet, err error) + type Lease struct + IPs []*net.IPNet + Length time.Duration + Start time.Time + func (l *Lease) Expired(t time.Time) bool + func (l *Lease) String() string + type LeaseStore interface + DeleteLease func(key uint64) error + Lease func(key uint64) (lease *Lease, ok bool, err error) + Leases func() (leases []*Lease, err error) + SaveLease func(key uint64, lease *Lease) error + type PurgeStats struct + FreedIPs map[string]int + type Store interface + Purge func(t time.Time) (*PurgeStats, error) + func FileStore(file string) (Store, error) + func IPStoreMetrics(reg *prometheus.Registry, ifi string, subnets []Subnet, ips Store) (Store, error) + func MemoryStore() Store + type Subnet struct + End net.IP + Reserved []net.IP + Start net.IP + Subnet net.IPNet + func (s *Subnet) Validate() error