api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ServeRoutesHandler added in v0.7.2

func ServeRoutesHandler(nlr bgp.RouteReaderWriter, lm LivenessManager, db DBReader, networkConfig *config.NetworkConfig) http.HandlerFunc

Types

type ApiServer

type ApiServer struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewApiServer

func NewApiServer(options ...Option) *ApiServer

type DBReader added in v0.7.2

type DBReader interface {
	GetState(userTypes ...UserType) []*ProvisionRequest
}

type KernelState added in v0.7.2

type KernelState string
const (
	KernelStateUnknown KernelState = "unknown"
	KernelStatePresent KernelState = "present"
	KernelStateAbsent  KernelState = "absent"
)

func (KernelState) String added in v0.7.2

func (r KernelState) String() string

type LivenessManager added in v0.7.2

type LivenessManager interface {
	GetSessions() []liveness.SessionSnapshot
}

type Option

type Option func(*ApiServer)

func WithBaseContext

func WithBaseContext(ctx context.Context) Option

func WithHandler

func WithHandler(mux *http.ServeMux) Option

func WithSockFile

func WithSockFile(sockFile string) Option

type ProvisionRequest

type ProvisionRequest struct {
	UserType           UserType     `json:"user_type"`
	TunnelSrc          net.IP       `json:"tunnel_src"`
	TunnelDst          net.IP       `json:"tunnel_dst"`
	TunnelNet          *net.IPNet   `json:"tunnel_net"`
	DoubleZeroIP       net.IP       `json:"doublezero_ip"`
	DoubleZeroPrefixes []*net.IPNet `json:"doublezero_prefixes"`
	MulticastSubGroups []net.IP     `json:"mcast_sub_groups"`
	MulticastPubGroups []net.IP     `json:"mcast_pub_groups"`
	BgpLocalAsn        uint32       `json:"bgp_local_asn"`
	BgpRemoteAsn       uint32       `json:"bgp_remote_asn"`
}

func (*ProvisionRequest) MarshalJSON

func (p *ProvisionRequest) MarshalJSON() ([]byte, error)

func (*ProvisionRequest) UnmarshalJSON

func (p *ProvisionRequest) UnmarshalJSON(data []byte) error

func (*ProvisionRequest) Validate

func (p *ProvisionRequest) Validate() error

type RemoveRequest

type RemoveRequest struct {
	UserType UserType `json:"user_type"`
}

func (*RemoveRequest) Validate

func (r *RemoveRequest) Validate() error

type Route added in v0.7.2

type Route struct {
	Network             string      `json:"network"`
	UserType            UserType    `json:"user_type"`
	LocalIP             string      `json:"local_ip"`
	PeerIP              string      `json:"peer_ip"`
	KernelState         KernelState `json:"kernel_state"`
	LivenessLastUpdated string      `json:"liveness_last_updated,omitempty"`
	LivenessState       string      `json:"liveness_state,omitempty"`
	LivenessStateReason string      `json:"liveness_state_reason,omitempty"`
}

type StatusRequest

type StatusRequest struct {
}

type StatusResponse

type StatusResponse struct {
	TunnelName       string      `json:"tunnel_name"`
	TunnelSrc        net.IP      `json:"tunnel_src"`
	TunnelDst        net.IP      `json:"tunnel_dst"`
	DoubleZeroIP     net.IP      `json:"doublezero_ip"`
	DoubleZeroStatus bgp.Session `json:"doublezero_status"`
	UserType         UserType    `json:"user_type"`
}

type UserType

type UserType int
const (
	UserTypeUnknown UserType = iota
	UserTypeIBRL
	UserTypeIBRLWithAllocatedIP
	UserTypeEdgeFiltering
	UserTypeMulticast
)

func (UserType) FromString

func (u UserType) FromString(userType string) UserType

func (UserType) MarshalJSON

func (u UserType) MarshalJSON() ([]byte, error)

func (UserType) String

func (u UserType) String() string

func (*UserType) UnmarshalJSON

func (u *UserType) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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