service

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Version contains the build and version info
	Version *client.Version
)

Functions

func Dir added in v1.2.5

func Dir(useLocal bool, name string) http.FileSystem

Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.

func FS added in v1.2.5

func FS(useLocal bool) http.FileSystem

FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSByte added in v1.2.5

func FSByte(useLocal bool, name string) ([]byte, error)

FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSMustByte added in v1.2.5

func FSMustByte(useLocal bool, name string) []byte

FSMustByte is the same as FSByte, but panics if name is not present.

func FSMustString added in v1.2.5

func FSMustString(useLocal bool, name string) string

FSMustString is the string version of FSMustByte.

func FSString added in v1.2.5

func FSString(useLocal bool, name string) (string, error)

FSString is the string version of FSByte.

func NewLease added in v1.2.0

func NewLease(hostname string, l *dhcp.Lease) *client.Lease

NewLease initializes a new lease object from a DHCP package

func RedirectHandler

func RedirectHandler(path string, code int) http.Handler

RedirectHandler redirects temporary to the given path

Types

type Key

type Key byte

Key is the context key

const (
	Content Key = iota
)

Context keys

type Query

type Query struct {
	Hostname string     `json:"hostname" xml:"hostname"`
	Mac      client.MAC `json:"mac" xml:"mac"`
	IP       net.IP     `json:"ip" xml:"ip"`
}

Query contains the request parametes

func NewQuery

func NewQuery(request *http.Request) (*Query, error)

NewQuery creates a new object from a http request * @param request - the http.Request

type Server

type Server interface {
	Init(ctx context.Context, args ...interface{})
	Start(ctx context.Context) chan bool
	Done() chan bool

	Hostname() string
	Port() uint16
}

func NewServer

func NewServer(l logger.Logger) Server

NewServer creates a new Server object

type ServerConfig

type ServerConfig struct {
	Local       net.IP                  `yaml:"local,omitempty" json:"local,omitempty" xml:"local,omitempty"`
	Remote      net.IP                  `yaml:"remote,omitempty" json:"remote,omitempty" xml:"remote,omitempty"`
	DHCPServer  string                  `yaml:"dhcpserver,omitempty" json:"dhcpserver,omitempty" xml:"dhcpserver,omitempty"`
	Relay       net.IP                  `yaml:"relay,omitempty" json:"relay,omitempty" xml:"relay,omitempty"`
	Mode        dhcp.ConnectionType     `yaml:"mode,omitempty" json:"mode,omitempty" xml:"mode,omitempty"`
	BaseURL     string                  `yaml:"baseurl,omitempty" json:"baseurl,omitempty" xml:"baseurl,omitempty"`
	Hostname    string                  `yaml:"hostname,omitempty" json:"hostname,omitempty" xml:"hostname,omitempty"`
	Port        uint16                  `yaml:"port,omitempty" json:"port,omitempty" xml:"port,omitempty"`
	Timeout     time.Duration           `yaml:"timeout,omitempty" json:"timeout,omitempty" xml:"timeout,omitempty"`
	DHCPTimeout time.Duration           `yaml:"dhcpTimeout,omitempty" json:"dhcpTimeout,omitempty" xml:"dhcpTimeout,omitempty"`
	Retry       time.Duration           `yaml:"retry,omitempty" json:"retry,omitempty" xml:"retry,omitempty"`
	Verbose     bool                    `yaml:"verbose,omitempty" json:"verbose,omitempty" xml:"verbose,omitempty"`
	AccessLog   bool                    `yaml:"accesslog,omitempty" json:"accesslog,omitempty" xml:"accesslog,omitempty"`
	Quiet       bool                    `yaml:"quiet,omitempty" json:"quiet,omitempty" xml:"quiet,omitempty"`
	KubeConfig  *dhcp.KubeServiceConfig `yaml:"kubeconfig,omitempty" json:"kubeconfig,omitempty" xml:"kubeconfig,omitempty"`
}

ServerConfig describes the server configuration

func (*ServerConfig) String

func (c *ServerConfig) String() string

Jump to

Keyboard shortcuts

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