util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Helper functions for iwebd

This package contains common helper functions used across iwebd. Not meant for consumption by other projects.

Index

Constants

This section is empty.

Variables

Functions

func GenKeyPair

func GenKeyPair() tls.Certificate

Generate a temporary, self-signed certificate/key pair for iwebd servers.

func GenListener

func GenListener(address string, defaultPort uint16) (net.Listener, error)

func ShowInterfaces

func ShowInterfaces(listenerAddr net.Addr)

Output information about how to reach a listener.

func SizeToHumanReadableSize

func SizeToHumanReadableSize(size int64) string

Return a human-readable representation of a file size.

func WaitToQuit

func WaitToQuit(appQuit <-chan int)

Helper function to allow servers to wait for either the server quitting or the user to interrupt the process, and then still cleaning up.

Types

type BonjourService

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

Wrapper around the Bonjour implementation

func RegisterBonjour

func RegisterBonjour(service string, txt []string, listenerAddr net.Addr) (svr *BonjourService)

Register a new service to be announced via Bonjour.

Arguments are the Bonjour service name, additional text parameters, and the listener of the service to allow this function to decide which interfaces to announce the service on.

func (*BonjourService) Shutdown

func (s *BonjourService) Shutdown()

type ColonSeparated

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

A cobra.Value implementation accepting and parsing a val1:val2 combination

func (*ColonSeparated) IsSet

func (v *ColonSeparated) IsSet() bool

func (*ColonSeparated) Set

func (v *ColonSeparated) Set(arg string) error

func (*ColonSeparated) String

func (v *ColonSeparated) String() string

func (*ColonSeparated) Type

func (v *ColonSeparated) Type() string

type UserPass

type UserPass struct {
	ColonSeparated
}

An argument for user:password pairs.

func (*UserPass) Password

func (v *UserPass) Password() string

func (*UserPass) Type

func (v *UserPass) Type() string

func (*UserPass) User

func (v *UserPass) User() string

Directories

Path Synopsis
Provides a simple logging interface for console applications.
Provides a simple logging interface for console applications.

Jump to

Keyboard shortcuts

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