api

package
v0.0.0-...-aa521ce Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultExpirationTime = 24 * time.Hour

Variables

View Source
var (
	ErrTokenNotFound = errors.New("token not found or already used")
	ErrTokenExpired  = errors.New("token has expired")
)

Functions

func InitTables

func InitTables(db *sql.DB) error

func NewAPIServer

func NewAPIServer(
	authService AuthService,
	ipamService ipam.IPAMService,
	allowedOrigins []string,
	nebulaPubAddr, caCert, caKey string,
) *web.Service

Types

type APIService

type APIService struct {
	AuthService AuthService
	IPAMService ipam.IPAMService

	NebulaPublicAddr string

	CACert string
	CAKey  string
}

func (APIService) ConnectGet

func (s APIService) ConnectGet(ctx context.Context, input struct{}, output *ConnectGetOutput) error

func (APIService) TokenGet

func (s APIService) TokenGet(ctx context.Context, input struct{}, output *TokenGetOutput) error

type AuthService

type AuthService struct {
	DB *sql.DB

	MasterToken         string
	MasterLocalhostOnly bool
	TokenAuthDisabled   bool
}

func (AuthService) MasterAuthMiddleware

func (s AuthService) MasterAuthMiddleware(next http.Handler) http.Handler

func (AuthService) NewToken

func (s AuthService) NewToken() (string, error)

func (AuthService) RequireAuthMiddleware

func (s AuthService) RequireAuthMiddleware(next http.Handler) http.Handler

func (AuthService) TokenAuthMiddleware

func (s AuthService) TokenAuthMiddleware(next http.Handler) http.Handler

func (AuthService) ValidateAndBurnToken

func (s AuthService) ValidateAndBurnToken(token string) error

type ConnectGetOutput

type ConnectGetOutput struct {
	ConnectionConfig string `json:"connection_config"`
}

type TokenGetOutput

type TokenGetOutput struct {
	OntTimeToken string `json:"one_time_token"`
}

Jump to

Keyboard shortcuts

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