dhcp

package
v0.0.0-...-68f935c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Discover uint8 = iota
	Offer
	Request
	Decline
	Ack
	Nak
	Release
	Inform
)

DHCP Message types

Variables

This section is empty.

Functions

func Test

func Test(psql *sql.DB) error

Test creates a copy of Server and tests the configuration

Types

type Server

type Server struct {
	APITokens []string
	DBHost    string
	// contains filtered or unexported fields
}

Server implements Tiat DHCP server.

func (*Server) AddClient

func (s *Server) AddClient(w http.ResponseWriter, r *http.Request)

AddClient adds a single client to dhcp4_knownclients

func (*Server) AddClientOption

func (s *Server) AddClientOption(w http.ResponseWriter, r *http.Request)

AddClientOption adds a single option to dhcp4_clientoptions

func (*Server) AddIP

func (s *Server) AddIP(w http.ResponseWriter, r *http.Request)

AddIP adds a single ip to dhcp4_staticips

func (*Server) AddPool

func (s *Server) AddPool(w http.ResponseWriter, r *http.Request)

AddPool adds a single pool to dhcp4_pools

func (*Server) AddPoolOption

func (s *Server) AddPoolOption(w http.ResponseWriter, r *http.Request)

AddPoolOption adds a single option to dhcp4_pooloptions

func (*Server) AddService

func (s *Server) AddService(w http.ResponseWriter, r *http.Request)

AddService adds a single service to dhcp4_services

func (*Server) AddSubnet

func (s *Server) AddSubnet(w http.ResponseWriter, r *http.Request)

AddSubnet adds a single subnet to dhcp4_subnets

func (*Server) AddVendorOption

func (s *Server) AddVendorOption(w http.ResponseWriter, r *http.Request)

AddVendorOption adds a single option to dhcp4_vendoroptions

func (*Server) DelClient

func (s *Server) DelClient(w http.ResponseWriter, r *http.Request)

DelClient deletes a single client from dhcp4_knownclients

func (*Server) DelClientOption

func (s *Server) DelClientOption(w http.ResponseWriter, r *http.Request)

DelClientOption deletes a single option from dhcp4_clientoptions

func (*Server) DelIP

func (s *Server) DelIP(w http.ResponseWriter, r *http.Request)

DelIP deletes a single ip from dhcp4_staticips

func (*Server) DelLease

func (s *Server) DelLease(w http.ResponseWriter, r *http.Request)

DelLease deletes a single lease from dhcp4_leases based on given mac and ip address

func (*Server) DelPool

func (s *Server) DelPool(w http.ResponseWriter, r *http.Request)

DelPool deletes a single pool from dhcp4_pools

func (*Server) DelPoolOption

func (s *Server) DelPoolOption(w http.ResponseWriter, r *http.Request)

DelPoolOption deletes a single option from dhcp4_pooloptions

func (*Server) DelService

func (s *Server) DelService(w http.ResponseWriter, r *http.Request)

DelService deletes a single service from dhcp4_services

func (*Server) DelSubnet

func (s *Server) DelSubnet(w http.ResponseWriter, r *http.Request)

DelSubnet deletes a single subnet from dhcp4_subnets

func (*Server) DelVendorOption

func (s *Server) DelVendorOption(w http.ResponseWriter, r *http.Request)

DelVendorOption deletes a single option from dhcp4_vendoroptions

func (*Server) GetClient

func (s *Server) GetClient(w http.ResponseWriter, r *http.Request)

GetClient returns a client entry from dhcp4_knownclients based on it's id

func (*Server) GetClientByClientID

func (s *Server) GetClientByClientID(w http.ResponseWriter, r *http.Request)

GetClientByClientID returns all entries for a clientid from dhcp4_knownclients

func (*Server) GetClientByValue

func (s *Server) GetClientByValue(w http.ResponseWriter, r *http.Request)

GetClientByValue returns a client entry from dhcp4_knownclients based on it's value

func (*Server) GetClientOptions

func (s *Server) GetClientOptions(w http.ResponseWriter, r *http.Request)

GetClientOptions returns all client's options from dhcp4_clientoptions

func (*Server) GetClients

func (s *Server) GetClients(w http.ResponseWriter, r *http.Request)

GetClients returns all clients from dhcp4_knownclients

func (*Server) GetClientsOptions

func (s *Server) GetClientsOptions(w http.ResponseWriter, r *http.Request)

GetClientsOptions returns all clients options from dhcp4_clientoptions

func (*Server) GetIP

func (s *Server) GetIP(w http.ResponseWriter, r *http.Request)

GetIP returns the configured IPs for the client from dhcp4_staticips

func (*Server) GetIPs

func (s *Server) GetIPs(w http.ResponseWriter, r *http.Request)

GetIPs returns all static IPs from dhcp4_staticips

func (*Server) GetLeaseByMac

func (s *Server) GetLeaseByMac(w http.ResponseWriter, r *http.Request)

GetLeaseByMac returns a single lease from dhcp4_leases based on given mac address

func (*Server) GetLeaseByOpt82

func (s *Server) GetLeaseByOpt82(w http.ResponseWriter, r *http.Request)

GetLeaseByOpt82 returns a single lease from dhcp4_leases based on given option82

func (*Server) GetLeases

func (s *Server) GetLeases(w http.ResponseWriter, r *http.Request)

GetLeases returns all leases from dhcp4_leases

func (*Server) GetPool

func (s *Server) GetPool(w http.ResponseWriter, r *http.Request)

GetPool returns a single pool from dhcp4_pools

func (*Server) GetPoolOptions

func (s *Server) GetPoolOptions(w http.ResponseWriter, r *http.Request)

GetPoolOptions returns all pool's options from dhcp4_pooloptions

func (*Server) GetPools

func (s *Server) GetPools(w http.ResponseWriter, r *http.Request)

GetPools returns all pools from dhcp4_pools

func (*Server) GetPoolsOptions

func (s *Server) GetPoolsOptions(w http.ResponseWriter, r *http.Request)

GetPoolsOptions returns all pools options from dhcp4_pooloptions

func (*Server) GetService

func (s *Server) GetService(w http.ResponseWriter, r *http.Request)

GetService returns a single service from dhcp4_services

func (*Server) GetServices

func (s *Server) GetServices(w http.ResponseWriter, r *http.Request)

GetServices returns all services from dhcp4_services

func (*Server) GetSubnet

func (s *Server) GetSubnet(w http.ResponseWriter, r *http.Request)

GetSubnet returns a single subnet from dhcp4_subnets

func (*Server) GetSubnets

func (s *Server) GetSubnets(w http.ResponseWriter, r *http.Request)

GetSubnets returns all subnets from dhcp4_subnets

func (*Server) GetVendorOption

func (s *Server) GetVendorOption(w http.ResponseWriter, r *http.Request)

GetVendorOption returns a single option from dhcp4_vendoroptions

func (*Server) GetVendorOptions

func (s *Server) GetVendorOptions(w http.ResponseWriter, r *http.Request)

GetVendorOptions returns all options from dhcp4_vendoroptions

func (*Server) Reload

func (s *Server) Reload(w http.ResponseWriter, r *http.Request)

Reload pauses the DHCP process and reloads the configuration

func (*Server) Start

func (s *Server) Start(addresses []net.IP, db *sql.DB) error

Start the DHCP server.

address is the IP the server will listen to and send as indentifier.

db is the backend connection to PostgreSQL.

func (*Server) UpdateClient

func (s *Server) UpdateClient(w http.ResponseWriter, r *http.Request)

UpdateClient changes a single client on dhcp4_knownclients

func (*Server) UpdateClientOption

func (s *Server) UpdateClientOption(w http.ResponseWriter, r *http.Request)

UpdateClientOption changes a single option on dhcp4_clientoptions

func (*Server) UpdateIP

func (s *Server) UpdateIP(w http.ResponseWriter, r *http.Request)

UpdateIP changes a single ip on dhcp4_staticips

func (*Server) UpdatePool

func (s *Server) UpdatePool(w http.ResponseWriter, r *http.Request)

UpdatePool changes a pool on dhcp4_pools

func (*Server) UpdatePoolOption

func (s *Server) UpdatePoolOption(w http.ResponseWriter, r *http.Request)

UpdatePoolOption changes a single option on dhcp4_pooloptions

func (*Server) UpdateService

func (s *Server) UpdateService(w http.ResponseWriter, r *http.Request)

UpdateService changes a single service on dhcp4_services

func (*Server) UpdateSubnet

func (s *Server) UpdateSubnet(w http.ResponseWriter, r *http.Request)

UpdateSubnet changes a subnet on dhcp4_subnets

func (*Server) UpdateVendorOption

func (s *Server) UpdateVendorOption(w http.ResponseWriter, r *http.Request)

UpdateVendorOption changes a single option on dhcp4_vendoroptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL