kdlib

package
v1.9.15 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSHKeyED25519Filename = "id_ed25519"
	SSHDefaultFilename    = SSHKeyED25519Filename
	SSHDefaultTimeOut     = time.Duration(5 * time.Second)
)
View Source
const APIRequestTimeout = 10 * time.Second

Variables

View Source
var ErrEmptySubdomain = errors.New("empty subdomain")

ErrEmptySubdomain - is returned when the subdomain is empty

View Source
var ErrNoSSHKeyFile = errors.New("no ssh key file")

Functions

func CreateDBPool

func CreateDBPool(ctx context.Context, dburl string) (*pgxpool.Pool, error)

func CreateSSHConfig

func CreateSSHConfig(filename, username string, timeout time.Duration) (*ssh.ClientConfig, error)

CreateSSHConfig - creates ssh client config.

func GetAllSlotsNumberJSONBytes

func GetAllSlotsNumberJSONBytes(num int32, active bool) []byte

func GetAllSlotsNumberStatement

func GetAllSlotsNumberStatement(schema string, active bool) string

func GetFreeSlotsNumberJSONBytes

func GetFreeSlotsNumberJSONBytes(num int32, active bool) []byte

func GetFreeSlotsNumberStatement

func GetFreeSlotsNumberStatement(schema string, active bool) string

func IsZeroEnding

func IsZeroEnding(ip netip.Addr) bool

IsZeroEnding - is last part zeroes.

func LastPrefixIPv4

func LastPrefixIPv4(p netip.Prefix) netip.Addr

LastPrefixIPv4 - last ip addr in the prefix.

func LastPrefixIPv6

func LastPrefixIPv6(p netip.Prefix) netip.Addr

LastPrefixIPv6 - last ip addr in the prefix.

func LookupForSSHKeyfile

func LookupForSSHKeyfile(keyFilename, path string) (string, error)

func NewSSHCient

func NewSSHCient(sshconf *ssh.ClientConfig, server string) (*ssh.Client, *bytes.Buffer, *bytes.Buffer, func(string), error)

func RandomAddrIPv4

func RandomAddrIPv4(p netip.Prefix) netip.Addr

RandomAddrIPv4 - random ipv4 addr inside prefix.

func RandomAddrIPv6

func RandomAddrIPv6(p netip.Prefix) netip.Addr

RandomAddrIPv6 - random ipv6 addr inside prefix.

func SSHSessionRun

func SSHSessionRun(client *ssh.Client, b, e *bytes.Buffer, cmd string) error

func SSHSessionStart

func SSHSessionStart(client *ssh.Client, b, e *bytes.Buffer, cmd string, data io.Reader) error

func SubdomainDelete

func SubdomainDelete(host, token, subdomain string) error

func SubdomainPick

func SubdomainPick(host, token string) (string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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