core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathExists

func PathExists(path string) (bool, error)

PathExists check path exist

Types

type DHCPService

type DHCPService struct {
	//Config Config
	ServiceIP      net.IP
	IPRangeStart   net.IP // dhcp ip range start
	IPRangeEnd     net.IP // dhcp ip range end
	LeaseDuration  time.Duration
	TFTPServerName string
	PXEBootImage   string // PXE boot file (TFTP)
	IPXEBootScript string // iPXE boot script (HTTP)
	EnableIPXE     bool
	// contains filtered or unexported fields
}

A DHCPService represents the state for the All service.

func (*DHCPService) ServeDHCP

func (s *DHCPService) ServeDHCP(request dhcp.Packet, msgType dhcp.MessageType, requestOptions dhcp.Options) (response dhcp.Packet)

ServeDHCP handles an incoming DHCP request.

type RecordLease

type RecordLease struct {
	// The MAC address of the machine to which the lease belongs.
	MACAddress string
	// The leased IPv4 address.
	IPAddress net.IP
	// The date and time when the lease expires.
	Expires time.Time
}

RecordLease represents a DHCP address and lease.

func (*RecordLease) IsExpired

func (r *RecordLease) IsExpired() bool

IsExpired determines whether the lease has expired.

type Service

type Service struct {
	//Config Config
	ServiceIP      string
	DocRoot        string
	ListenIP       string
	HTTPPort       string // http listen port default 80
	HTTPRoot       string // http document root default netboot
	TFTPPort       string // tftp listen port default 69
	TFTPRoot       string // tftp document root default netboot
	DHCPPort       string // dhcp listen port default 67
	IPRangeStart   string // dhcp ip range start
	IPRangeEnd     string // dhcp ip range end
	NetMask        string // dhcp netmask default 255.255.255.0
	Router         string
	DNSServer      string
	TFTPServerName string
	PXEBootImage   string // PXE boot file (TFTP)
	IPXEBootScript string // iPXE boot script (HTTP)
	EnableIPXE     bool
	// contains filtered or unexported fields
}

A Service represents the state for the All service.

func NewService

func NewService() *Service

NewService creates new Service state.

func (*Service) Initialize

func (s *Service) Initialize(path string) error

Initialize the service configuration.

func (*Service) LoadAndRenderTemplates

func (s *Service) LoadAndRenderTemplates() (err error)

LoadAndRenderTemplates load tmpl from templates folder

func (*Service) Prepare

func (s *Service) Prepare() error

Prepare env

func (*Service) Shutdown

func (s *Service) Shutdown()

Shutdown causes Serve() to exit, cleaning up behind itself.

func (*Service) Start

func (s *Service) Start() error

Start the service.

Jump to

Keyboard shortcuts

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