provision: github.com/digitalrebar/provision/midlayer Index | Files

package midlayer

import "github.com/digitalrebar/provision/midlayer"

midlayer contains the DHCP server code for DigitalRebar Provision. It has the responsibility for providing the actual data manipulate for the DHCP Protocol.

Index

Package Files

actions.go controller.go dhcp.go dhcpUtil.go doc.go messaging.go messaging_client.go messaging_server.go stack.go static.go tftp.go

func CleanUpStore Uses

func CleanUpStore(st store.Store) error

func MacStrategy Uses

func MacStrategy(p dhcp.Packet, options dhcp.Options) string

func ReverseProxy Uses

func ReverseProxy(l logger.Logger, pluginCommDir string) gin.HandlerFunc

func ServeStatic Uses

func ServeStatic(listenAt string, responder http.Handler, logger logger.Logger, pubs *backend.Publishers) (*http.Server, error)

type Actions Uses

type Actions struct {
    // contains filtered or unexported fields
}

func NewActions Uses

func NewActions() *Actions

func (*Actions) Add Uses

func (ma *Actions) Add(model_aa models.AvailableAction, plugin *RunningPlugin) error

func (*Actions) Get Uses

func (ma *Actions) Get(ob, name string) (AvailableActions, bool)

func (*Actions) GetSpecific Uses

func (ma *Actions) GetSpecific(ob, name, plugin string) (*AvailableAction, bool)

func (*Actions) List Uses

func (ma *Actions) List(ob string) []AvailableActions

func (*Actions) Remove Uses

func (ma *Actions) Remove(aa models.AvailableAction, plugin *RunningPlugin) error

func (*Actions) Run Uses

func (ma *Actions) Run(rt *backend.RequestTracker, ob string, maa *models.Action) (interface{}, error)

type AvailableAction Uses

type AvailableAction struct {
    models.AvailableAction

    Plugin *RunningPlugin
    // contains filtered or unexported fields
}

func (*AvailableAction) Release Uses

func (aa *AvailableAction) Release()

func (*AvailableAction) Reserve Uses

func (aa *AvailableAction) Reserve() error

func (*AvailableAction) Unload Uses

func (aa *AvailableAction) Unload()

type AvailableActions Uses

type AvailableActions []*AvailableAction

type DataStack Uses

type DataStack struct {
    store.StackedStore
    // contains filtered or unexported fields
}

func DefaultDataStack Uses

func DefaultDataStack(dataRoot, backendType, localContent, defaultContent, saasDir string) (*DataStack, error)

func (*DataStack) AddReplacePlugin Uses

func (d *DataStack) AddReplacePlugin(
    name string,
    newStore store.Store,
    logger logger.Logger,
    fixup FixerUpper) (*DataStack, error, error)

func (*DataStack) AddReplaceSAAS Uses

func (d *DataStack) AddReplaceSAAS(
    name string,
    newStore store.Store,
    logger logger.Logger,
    fixup FixerUpper) (*DataStack, error, error)

func (*DataStack) Clone Uses

func (d *DataStack) Clone() *DataStack

func (*DataStack) RemovePlugin Uses

func (d *DataStack) RemovePlugin(name string, logger logger.Logger) (*DataStack, error, error)

func (*DataStack) RemoveSAAS Uses

func (d *DataStack) RemoveSAAS(name string, logger logger.Logger) (*DataStack, error, error)

type DhcpHandler Uses

type DhcpHandler struct {
    logger.Logger
    // contains filtered or unexported fields
}

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 Uses

func (h *DhcpHandler) NewRequest(buf []byte, cm *ipv4.ControlMessage, srcAddr net.Addr) *DhcpRequest

func (*DhcpHandler) Serve Uses

func (h *DhcpHandler) Serve() error

func (*DhcpHandler) Shutdown Uses

func (h *DhcpHandler) Shutdown(ctx context.Context) error

type DhcpRequest Uses

type DhcpRequest struct {
    logger.Logger
    // contains filtered or unexported fields
}

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 Uses

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 Uses

func (dhr *DhcpRequest) MarshalText() ([]byte, error)

func (*DhcpRequest) PrintIncoming Uses

func (dhr *DhcpRequest) PrintIncoming() string

func (*DhcpRequest) PrintOutgoing Uses

func (dhr *DhcpRequest) PrintOutgoing(p dhcp.Packet) string

func (*DhcpRequest) Process Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (dhr *DhcpRequest) Strategy(name string) StrategyFunc

func (*DhcpRequest) UnmarshalText Uses

func (dhr *DhcpRequest) UnmarshalText(buf []byte) error

type FixerUpper Uses

type FixerUpper func(*DataStack, store.Store) error

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 Uses

type ObjectCommands map[string]AvailableActions

type ObjectsCommands Uses

type ObjectsCommands map[string]ObjectCommands

type PluginClient Uses

type PluginClient struct {
    logger.Logger
    // contains filtered or unexported fields
}

func NewPluginClient Uses

func NewPluginClient(pc *PluginController, pluginCommDir, plugin string, l logger.Logger, apiURL, staticURL, token, path string, params map[string]interface{}) (answer *PluginClient, theErr error)

func (*PluginClient) Action Uses

func (pc *PluginClient) Action(rt *backend.RequestTracker, a *models.Action) (interface{}, error)

func (*PluginClient) Config Uses

func (pc *PluginClient) Config(params map[string]interface{}) error

func (*PluginClient) Publish Uses

func (pc *PluginClient) Publish(e *models.Event) error

func (*PluginClient) Release Uses

func (pc *PluginClient) Release()

func (*PluginClient) Reserve Uses

func (pc *PluginClient) Reserve() error

func (*PluginClient) Stop Uses

func (pc *PluginClient) Stop() error

func (*PluginClient) Unload Uses

func (pc *PluginClient) Unload()

type PluginController Uses

type PluginController struct {
    logger.Logger

    AvailableProviders map[string]*models.PluginProvider

    Actions *Actions
    // contains filtered or unexported fields
}

func InitPluginController Uses

func InitPluginController(pluginDir, pluginCommDir string, dt *backend.DataTracker, pubs *backend.Publishers) (pc *PluginController, err error)

func (*PluginController) GetPluginProvider Uses

func (pc *PluginController) GetPluginProvider(name string) *models.PluginProvider

func (*PluginController) GetPluginProviders Uses

func (pc *PluginController) GetPluginProviders() []*models.PluginProvider

func (*PluginController) Publish Uses

func (pc *PluginController) Publish(e *models.Event) error

func (*PluginController) Release Uses

func (pc *PluginController) Release()

func (*PluginController) RemovePlugin Uses

func (pc *PluginController) RemovePlugin(name string) error

func (*PluginController) Request Uses

func (pc *PluginController) Request(locks ...string) *backend.RequestTracker

func (*PluginController) Reserve Uses

func (pc *PluginController) Reserve() error

This never gets unloaded.

func (*PluginController) Shutdown Uses

func (pc *PluginController) Shutdown(ctx context.Context) error

func (*PluginController) StartController Uses

func (pc *PluginController) StartController(apiGroup *gin.RouterGroup) error

func (*PluginController) Unload Uses

func (pc *PluginController) Unload()

func (*PluginController) UploadPlugin Uses

func (pc *PluginController) UploadPlugin(c *gin.Context, fileRoot, name string) (*models.PluginProviderUploadInfo, *models.Error)

type RunningPlugin Uses

type RunningPlugin struct {
    Plugin   *backend.Plugin
    Provider *models.PluginProvider
    Client   *PluginClient
}

type Service Uses

type Service interface {
    Shutdown(context.Context) error
}

func ServeTftp Uses

func ServeTftp(listen string, responder func(string, net.IP) (io.Reader, error),
    log logger.Logger, pubs *backend.Publishers) (Service, error)

func StartDhcpHandler Uses

func StartDhcpHandler(dhcpInfo *backend.DataTracker,
    log logger.Logger,
    dhcpIfs string,
    dhcpPort int,
    pubs *backend.Publishers,
    proxyOnly bool,
    fakePinger bool) (Service, error)

type Strategy Uses

type Strategy struct {
    Name     string
    GenToken StrategyFunc
}

type StrategyFunc Uses

type StrategyFunc func(p dhcp.Packet, options dhcp.Options) string

type TftpHandler Uses

type TftpHandler struct {
    // contains filtered or unexported fields
}

func (*TftpHandler) Shutdown Uses

func (h *TftpHandler) Shutdown(ctx context.Context) error

Package midlayer imports 35 packages (graph) and is imported by 2 packages. Updated 2018-02-22. Refresh now. Tools for package owners.