Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.3.103 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package api pkg/deployment/tps/api/api.go c2-net-transport

Package api pkg/deployment/tps/api/endpoints.go c2-net-transport

Package api pkg/deployment/tps/api/rpc_gateway.go c2-net-transport

Package api pkg/deployment/tps/api/utils.go c2-net-transport

Index

Constants

This section is empty.

Variables

View Source
var ErrRemoteRemovalNotAllowed = errors.New("transport removal not allowed via remote interface")

ErrRemoteRemovalNotAllowed is returned when a remote caller tries to remove a transport.

Functions

This section is empty.

Types

type API

type API struct {
	http.Handler
	// contains filtered or unexported fields
}

API register all the API endpoints. It implements a net/http.Handler.

func New

func New(log *logging.Logger, conf config.Config) *API

New constructs a new API instance.

func (*API) ServeDmsg

func (api *API) ServeDmsg(ctx context.Context) error

ServeDmsg starts the dmsg RPC listener for the transport setup service.

type Error

type Error struct {
	Error string `json:"error"`
}

Error is the object returned to the client when there's an error.

type GetTransportsRequest

type GetTransportsRequest struct {
	TargetPK cipher.PubKey
}

GetTransportsRequest is the input for GetTransports RPC.

type GetTransportsResponse

type GetTransportsResponse struct {
	Transports []TransportSetupResponse
}

GetTransportsResponse is the response for GetTransports RPC.

type HealthCheckArgs

type HealthCheckArgs struct{}

HealthCheckArgs is an empty struct for the health check call.

type HealthCheckReply

type HealthCheckReply struct {
	Status string
}

HealthCheckReply is returned by the HealthCheck RPC method.

type RemoveTransportRequest

type RemoveTransportRequest struct {
	TargetPK cipher.PubKey
	ID       string
}

RemoveTransportRequest is the input for RemoveTransport RPC.

type SetupRPCGateway

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

SetupRPCGateway handles RPC requests from remote visors over dmsg.

func (*SetupRPCGateway) AddTransport

func (g *SetupRPCGateway) AddTransport(req *TransportSetupRequest, reply *TransportSetupResponse) error

AddTransport requests a transport be created on the target visor.

func (*SetupRPCGateway) GetTransports

func (g *SetupRPCGateway) GetTransports(req *GetTransportsRequest, reply *GetTransportsResponse) error

GetTransports retrieves the list of transports from a target visor.

func (*SetupRPCGateway) HealthCheck

func (g *SetupRPCGateway) HealthCheck(_ *HealthCheckArgs, reply *HealthCheckReply) error

HealthCheck tests if the setup node is responsive.

func (*SetupRPCGateway) RemoveTransport

func (g *SetupRPCGateway) RemoveTransport(_ *RemoveTransportRequest, _ *struct{}) error

RemoveTransport is blocked for remote callers - transport removal only via local HTTP.

type TransportRequest

type TransportRequest struct {
	From cipher.PubKey `json:"from" validate:"required"`
	To   cipher.PubKey `json:"to" validate:"required"`
	Type string        `json:"type" validate:"required"`
}

TransportRequest specifies a transport between two nodes and its type

type TransportSetupRequest

type TransportSetupRequest struct {
	TargetPK cipher.PubKey // visor to add transport on
	RemotePK cipher.PubKey // other transport edge
	Type     string        // transport type
}

TransportSetupRequest is the input for AddTransport RPC.

type TransportSetupResponse

type TransportSetupResponse struct {
	ID     uuid.UUID
	Local  cipher.PubKey
	Remote cipher.PubKey
	Type   string
}

TransportSetupResponse is the response for AddTransport RPC. ID is uuid.UUID to match the gob-wire format used by the visor's embedded TPS gateway (pkg/visor TPSSetupResponse). Both listen on DmsgTransportSetupServicePort and a client that decodes into one shape cannot decode data serialized from the other, so the wire types MUST match.

type UUIDRequest

type UUIDRequest struct {
	From cipher.PubKey `json:"from" validate:"required"`
	ID   uuid.UUID     `json:"id" validate:"required"`
}

UUIDRequest combines target visor and UUID of a transport there

Jump to

Keyboard shortcuts

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