dcmgmt

package
v1.10.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DelegationSyncFilename       = "domain-generate-%s.csv"
	DelegationSyncReloadFilename = "domain-generate.reload"
)
View Source
const (
	DomainCheckPause         = 5 * time.Second
	DomainDelegationWaitTime = 120 * time.Second
)
View Source
const (
	KdAddrSyncFilename       = "vpn-works-%s.csv"
	KdAddrSyncReloadFilename = "vpn-works-keydesks.reload"
)
View Source
const (
	BrigadeCgnatPrefix = 24
	BrigadeUlaPrefix   = 64
)
View Source
const (
	VgsOrderStatusAccepted   = "accepted"
	VgsOrderStatusProcessing = "processing"
	VgsOrderStatusFailed     = "failed"
	VgsOrderStatusCompleted  = "completed"
)
View Source
const (
	VgsOrderPopStatusAccepted         = "accepted"
	VgsOrderPopStatusPairCompleted    = "pair_completed"
	VgsOrderPopStatusBrigadeCompleted = "brigade_completed"
	VgsOrderPopStatusFailed           = "failed"
	VgsOrderPopStatusCompleted        = "completed"
)
View Source
const DefaultRandomAttemts = 10000
View Source
const (
	DefaultVgsOrderRetryAfter = 300 // seconds
)
View Source
const MAX_DNS_RETRIES = 3
View Source
const NoUseSubdomainAPIToken = "-"
View Source
const VgsActionCreateBrigade = "create_brigade"
View Source
const VgsActionDeleteBrigade = "delete_brigade"

Variables

View Source
var (
	ErrUnknownIP       = errors.New("unknown ip address")
	ErrNegativeRcode   = errors.New("negative rcode")
	ErrRetriesExceeded = errors.New("retries exceeded")
)
View Source
var (
	ErrEmptyConnString   = errors.New("empty sync connect string")
	ErrInvalidConnString = errors.New("invalid sync connect string")
	ErrInvalidServerHost = errors.New("invalid sync server host")
	ErrInvalidServerPort = errors.New("invalid sync server port")
	ErrEmptyIdent        = errors.New("empty ident")
	ErrEmptyID           = errors.New("empty id")
)
View Source
var (
	ErrInvalidStatus = fmt.Errorf("invalid status")
	ErrInvalidAction = fmt.Errorf("invalid action")
)
View Source
var ErrCheckAttemptExceeded = errors.New("check attempt exceeded")
View Source
var ErrDeleteAttemptsCountExceeded = errors.New("delete attempts count exceeded")
View Source
var ErrEmptyNSString = errors.New("empty ns connect string")
View Source
var ErrNotDelegated = errors.New("not delegated")
View Source
var ErrRandomAttemptsExceeded = errors.New("random attempts exceeded")

Functions

func ApplySubdomain added in v1.9.0

func ApplySubdomain(ctx context.Context, db *pgxpool.Pool, apihost, apitoken string, brigadeID string, endpointIPv4 netip.Addr, srvZone string) error

func AssembleAppPath added in v1.9.19

func AssembleAppPath(app string, zone string) string

func CheckForPresence

func CheckForPresence(fqdn string, ip netip.Addr, nameservers ...string) (bool, error)

Check for the presence of a record in the NS-servers

func NewDelegationList

func NewDelegationList(ctx context.Context, db *pgxpool.Pool, schema string) (string, error)

func NewKdAddrList

func NewKdAddrList(ctx context.Context, db *pgxpool.Pool, schema string) (string, error)

func ParseConnEnv

func ParseConnEnv(connenv string) (string, string, error)

func ParseDCNameEnv

func ParseDCNameEnv() (string, string, error)

func ParseNSEnv

func ParseNSEnv(nsenv string) ([]string, error)

func RandomCGNAT24Net added in v1.9.0

func RandomCGNAT24Net() (netip.Prefix, error)

func RandomKeydesk added in v1.9.0

func RandomKeydesk() (netip.Addr, error)

func RandomULA64Net added in v1.9.0

func RandomULA64Net() (netip.Prefix, error)

func RevokeSubdomain added in v1.9.1

func RevokeSubdomain(ctx context.Context, db *pgxpool.Pool, apihost, apitoken string, domain string) error

func SyncDelegationList

func SyncDelegationList(sshconf *ssh.ClientConfig, delegationSyncServer, ident, kdAddrList string) (func(string), error)

func SyncKdAddrList

func SyncKdAddrList(sshconf *ssh.ClientConfig, kdAddrSyncServer, ident, kdAddrList string) (func(string), error)

func VgsCheckOrderStatus added in v1.9.11

func VgsCheckOrderStatus(ctx context.Context, _ *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	orderID uuid.UUID,
) (string, int64, error)

func VgsCreateBrigade added in v1.9.1

func VgsCreateBrigade(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	orderID uuid.UUID,
	dcident string,
	host, token string,
	sshkey, sshuser, server string,
	ns []string, vpnCfgs *VpnCfgs,
	maxusers int,
	doNotCreatePhy bool,
) error

func VgsCreatePair added in v1.9.1

func VgsCreatePair(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	app string, orderID uuid.UUID, doNotCreatePhy bool,
) error

func VgsDeleteBrigade added in v1.9.1

func VgsDeleteBrigade(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	orderID uuid.UUID,
	dcident string,
	host, token string,
	sshkey, sshuser, server string,
	doNotCreatePhy bool,
) error

func VgsDeletePair added in v1.9.1

func VgsDeletePair(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	app string, orderID uuid.UUID, doNotCreatePhy bool,
) error

func VgsOrderCreateBrigade added in v1.9.1

func VgsOrderCreateBrigade(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	brigadeID uuid.UUID, brigadeName string, zone string,
) (uuid.UUID, string, int64, error)

VgsOrderCreateBrigade creates an order to create a brigade.

func VgsOrderDeleteBrigade added in v1.9.1

func VgsOrderDeleteBrigade(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	brigadeID uuid.UUID,
) (uuid.UUID, string, int64, error)

VgsOrderDeleteBrigade creates an order to create a brigade.

func VgsPopOrder added in v1.9.11

func VgsPopOrder(ctx context.Context, logger *slog.Logger, db *pgxpool.Pool, sqfmt sq.StatementBuilderType,
	action, status string,
) (uuid.UUID, error)

VgsPopOrder - pop order from the queue action: - vgsActionCreateBrigade

  • status: accepted, pair_completed, failed, completed

- vgsActionDeleteBrigade

  • status: accepted, processing, failed, completed

func WaitForDelegation added in v1.9.0

func WaitForDelegation(fqdn string, ip netip.Addr, ns ...string) (bool, error)

Types

type VgsPairsResult added in v1.9.1

type VgsPairsResult struct {
	Status  string `json:"status"`
	Result  string `json:"result,omitempty"`
	Control struct {
		IP netip.Addr `json:"ip"`
	} `json:"control,omitempty"`
	Endpoint struct {
		IP netip.Addr `json:"ip"`
	} `json:"endpoint,omitempty"`
}

type VpnCfgs added in v1.9.1

type VpnCfgs struct {
	Wg      string
	Ovc     string
	Ipsec   string
	Outline string
}

Jump to

Keyboard shortcuts

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