Documentation ¶
Overview ¶
midlayer contains the DHCP server code for DigitalRebar Provision. It has the responsibility for providing the actual data manipulate for the DHCP Protocol.
Index ¶
- Constants
- func CleanUpStore(st store.Store) error
- func MacStrategy(p dhcp.Packet, options dhcp.Options) string
- func OsUdpProtoCheck() string
- func ReverseProxy(pc *PluginController) gin.HandlerFunc
- func ServeStatic(listenAt string, responder http.Handler, logger logger.Logger, ...) (*http.Server, error)
- type Actions
- func (ma *Actions) Add(model_aa models.AvailableAction, plugin *RunningPlugin) error
- func (ma *Actions) Get(ob, name string) (AvailableActions, bool)
- func (ma *Actions) GetSpecific(ob, name, plugin string) (*AvailableAction, bool)
- func (ma *Actions) List(ob string) []AvailableActions
- func (ma *Actions) Remove(aa models.AvailableAction, plugin *RunningPlugin) error
- func (ma *Actions) Run(rt *backend.RequestTracker, ob string, maa *models.Action) (interface{}, error)
- type AvailableAction
- type AvailableActions
- type DataStack
- func (d *DataStack) AddReplacePluginLayer(name string, newStore store.Store, logger logger.Logger, fixup FixerUpper) (*DataStack, error, error)
- func (d *DataStack) AddReplaceSAAS(name string, newStore store.Store, logger logger.Logger, fixup FixerUpper) (*DataStack, error, error)
- func (d *DataStack) Clone() *DataStack
- func (d *DataStack) RemovePluginLayer(name string, logger logger.Logger) (*DataStack, error, error)
- func (d *DataStack) RemoveSAAS(name string, logger logger.Logger) (*DataStack, error, error)
- type DhcpHandler
- type DhcpRequest
- func (dhr *DhcpRequest) FakeLease(req net.IP) (*backend.Lease, *backend.Subnet, *backend.Reservation)
- func (dhr *DhcpRequest) MarshalText() ([]byte, error)
- func (dhr *DhcpRequest) PrintIncoming() string
- func (dhr *DhcpRequest) PrintOutgoing(p dhcp.Packet) string
- func (dhr *DhcpRequest) Process() dhcp.Packet
- func (dhr *DhcpRequest) Request(locks ...string) *backend.RequestTracker
- func (dhr *DhcpRequest) Run()
- func (dhr *DhcpRequest) ServeBinl(msgType dhcp.MessageType) dhcp.Packet
- func (dhr *DhcpRequest) ServeDHCP(msgType dhcp.MessageType) dhcp.Packet
- func (dhr *DhcpRequest) Strategy(name string) StrategyFunc
- func (dhr *DhcpRequest) UnmarshalText(buf []byte) error
- type FixerUpper
- type ObjectCommands
- type ObjectsCommands
- type PluginClient
- func (pc *PluginClient) Action(rt *backend.RequestTracker, a *models.Action) (interface{}, error)
- func (pc *PluginClient) Config(params map[string]interface{}) error
- func (pc *PluginClient) Publish(e *models.Event) error
- func (pc *PluginClient) Release()
- func (pc *PluginClient) Reserve() error
- func (pc *PluginClient) Stop() error
- func (pc *PluginClient) Unload()
- type PluginController
- func (pc *PluginController) GetPluginProvider(name string) *models.PluginProvider
- func (pc *PluginController) GetPluginProviders() []*models.PluginProvider
- func (pc *PluginController) Publish(e *models.Event) error
- func (pc *PluginController) Release()
- func (pc *PluginController) RemovePluginProvider(name string) error
- func (pc *PluginController) Request(locks ...string) *backend.RequestTracker
- func (pc *PluginController) Reserve() error
- func (pc *PluginController) Shutdown(ctx context.Context) error
- func (pc *PluginController) StartController() error
- func (pc *PluginController) StartPlugins()
- func (pc *PluginController) StartRouter(apiGroup *gin.RouterGroup)
- func (pc *PluginController) Unload()
- func (pc *PluginController) UploadPluginProvider(c *gin.Context, fileRoot, name string) (*models.PluginProviderUploadInfo, *models.Error)
- type RunningPlugin
- type Service
- type Strategy
- type StrategyFunc
- type TftpHandler
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func CleanUpStore ¶
func OsUdpProtoCheck ¶
func OsUdpProtoCheck() string
func ReverseProxy ¶
func ReverseProxy(pc *PluginController) gin.HandlerFunc
Types ¶
type Actions ¶
type Actions struct {
// contains filtered or unexported fields
}
func NewActions ¶
func NewActions() *Actions
func (*Actions) Add ¶
func (ma *Actions) Add(model_aa models.AvailableAction, plugin *RunningPlugin) error
func (*Actions) GetSpecific ¶
func (ma *Actions) GetSpecific(ob, name, plugin string) (*AvailableAction, bool)
func (*Actions) List ¶
func (ma *Actions) List(ob string) []AvailableActions
func (*Actions) Remove ¶
func (ma *Actions) Remove(aa models.AvailableAction, plugin *RunningPlugin) error
type AvailableAction ¶
type AvailableAction struct { models.AvailableAction Plugin *RunningPlugin // contains filtered or unexported fields }
func (*AvailableAction) Release ¶
func (aa *AvailableAction) Release()
func (*AvailableAction) Reserve ¶
func (aa *AvailableAction) Reserve() error
func (*AvailableAction) Unload ¶
func (aa *AvailableAction) Unload()
type AvailableActions ¶
type AvailableActions []*AvailableAction
type DataStack ¶
type DataStack struct { store.StackedStore // contains filtered or unexported fields }
func DefaultDataStack ¶
func (*DataStack) AddReplacePluginLayer ¶
func (*DataStack) AddReplaceSAAS ¶
func (*DataStack) RemovePluginLayer ¶
type DhcpHandler ¶
DhcpHandler is responsible for listening to incoming DHCP packets, building a DhcpRequest for each one, then kicking that reqest off to handle the packet.
func (*DhcpHandler) NewRequest ¶
func (h *DhcpHandler) NewRequest(buf []byte, cm *ipv4.ControlMessage, srcAddr net.Addr) *DhcpRequest
func (*DhcpHandler) Serve ¶
func (h *DhcpHandler) Serve() error
type DhcpRequest ¶
DhcpRequest records all the information needed to handle a single in-flight DHCP request. One of these is created for every incoming DHCP packet.
func (*DhcpRequest) FakeLease ¶
func (dhr *DhcpRequest) FakeLease(req net.IP) (*backend.Lease, *backend.Subnet, *backend.Reservation)
FakeLease is a helper function for fetching a fake lease from the backend. We use fake leases when handling ProxyDHCP and binl requests, as we don't actually want to allocate an IP address or anything crazy like that.
func (*DhcpRequest) MarshalText ¶
func (dhr *DhcpRequest) MarshalText() ([]byte, error)
func (*DhcpRequest) PrintIncoming ¶
func (dhr *DhcpRequest) PrintIncoming() string
func (*DhcpRequest) PrintOutgoing ¶
func (dhr *DhcpRequest) PrintOutgoing(p dhcp.Packet) string
func (*DhcpRequest) Process ¶
func (dhr *DhcpRequest) Process() dhcp.Packet
Process is responsible for checking basic sanity of an incoming DHCP packet, handing it off to ServeDHCP or ServeBinl, and performing some common post-processing if we have an outgoing packet to send.
func (*DhcpRequest) Request ¶
func (dhr *DhcpRequest) Request(locks ...string) *backend.RequestTracker
Request is a shorthand function for creating a RequestTracker to interact with the backend.
func (*DhcpRequest) Run ¶
func (dhr *DhcpRequest) Run()
Run processes an incoming DhcpRequest and sends the resulting packet (if any) back out over the same interface it came in on.
func (*DhcpRequest) ServeBinl ¶
func (dhr *DhcpRequest) ServeBinl(msgType dhcp.MessageType) dhcp.Packet
ServeBinl is responsible for handling ProxyDHCP Request messages and binl Discover messages. Both of those come in on port 4011.
func (*DhcpRequest) ServeDHCP ¶
func (dhr *DhcpRequest) ServeDHCP(msgType dhcp.MessageType) dhcp.Packet
ServeDHCP is responsible for handling regular DHCP traffic as well as ProxyDHCP DISCOVER messages -- essentially everything that comes in on port 67.
func (*DhcpRequest) Strategy ¶
func (dhr *DhcpRequest) Strategy(name string) StrategyFunc
func (*DhcpRequest) UnmarshalText ¶
func (dhr *DhcpRequest) UnmarshalText(buf []byte) error
type FixerUpper ¶
FixerUpper takes a the datastack and a store.Store that is to be added to the passed stack. FixerUpper is responsible for making sure that it can integrate the new store into the stack, making whatever changes are needed to the current datastack to make inclusion possible. It must take care to scan and detect if it will not be able to maek changes, because any changes it has to make to items in the data stack will be live and not possible to undo after FixerUpper returns.
type ObjectCommands ¶
type ObjectCommands map[string]AvailableActions
type ObjectsCommands ¶
type ObjectsCommands map[string]ObjectCommands
type PluginClient ¶
func NewPluginClient ¶
func NewPluginClient(pc *PluginController, pluginCommDir, plugin, provider string, l logger.Logger, apiURL, staticURL, token, path string) (answer *PluginClient, theErr error)
func (*PluginClient) Action ¶
func (pc *PluginClient) Action(rt *backend.RequestTracker, a *models.Action) (interface{}, error)
func (*PluginClient) Config ¶
func (pc *PluginClient) Config(params map[string]interface{}) error
func (*PluginClient) Release ¶
func (pc *PluginClient) Release()
func (*PluginClient) Reserve ¶
func (pc *PluginClient) Reserve() error
func (*PluginClient) Stop ¶
func (pc *PluginClient) Stop() error
func (*PluginClient) Unload ¶
func (pc *PluginClient) Unload()
type PluginController ¶
type PluginController struct { logger.Logger AvailableProviders map[string]*models.PluginProvider Actions *Actions // contains filtered or unexported fields }
func InitPluginController ¶
func InitPluginController(pluginDir, pluginCommDir string, dt *backend.DataTracker, pubs *backend.Publishers) (pc *PluginController, err error)
* Create contoller and start an event listener.
func (*PluginController) GetPluginProvider ¶
func (pc *PluginController) GetPluginProvider(name string) *models.PluginProvider
func (*PluginController) GetPluginProviders ¶
func (pc *PluginController) GetPluginProviders() []*models.PluginProvider
func (*PluginController) Release ¶
func (pc *PluginController) Release()
func (*PluginController) RemovePluginProvider ¶
func (pc *PluginController) RemovePluginProvider(name string) error
func (*PluginController) Request ¶
func (pc *PluginController) Request(locks ...string) *backend.RequestTracker
func (*PluginController) Reserve ¶
func (pc *PluginController) Reserve() error
This never gets unloaded.
func (*PluginController) StartController ¶
func (pc *PluginController) StartController() error
func (*PluginController) StartPlugins ¶
func (pc *PluginController) StartPlugins()
func (*PluginController) StartRouter ¶
func (pc *PluginController) StartRouter(apiGroup *gin.RouterGroup)
func (*PluginController) Unload ¶
func (pc *PluginController) Unload()
func (*PluginController) UploadPluginProvider ¶
func (pc *PluginController) UploadPluginProvider(c *gin.Context, fileRoot, name string) (*models.PluginProviderUploadInfo, *models.Error)
type RunningPlugin ¶
type RunningPlugin struct { Plugin *models.Plugin Provider *models.PluginProvider Client *PluginClient // contains filtered or unexported fields }
type Strategy ¶
type Strategy struct { Name string GenToken StrategyFunc }
type TftpHandler ¶
type TftpHandler struct {
// contains filtered or unexported fields
}