pubsubenroll

package
v0.0.0-...-f174eeb Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeEnrollRequest  = "enroll-request"
	TypeEnrollResponse = "enroll-response"
)

Variables

This section is empty.

Functions

func GetGoogleMetadata

func GetGoogleMetadata(ctx context.Context, path string) ([]byte, error)

func GetGoogleMetadataString

func GetGoogleMetadataString(ctx context.Context, path string) (string, error)

Types

type DeviceRequest

type DeviceRequest struct {
	Platform           string `json:"platform"`
	Owner              string `json:"owner"`
	Serial             string `json:"serial"`
	WireGuardPublicKey []byte `json:"wireguard_public_key"`
}

type GatewayClient

type GatewayClient struct {
	Name             string `json:"name"`
	EnrollProjectID  string `json:"project_id"`
	TopicName        string `json:"topic_name"`
	SubscriptionName string `json:"subscription_name"`
	ExternalIP       string `json:"external_ip"`
	// contains filtered or unexported fields
}

func NewGatewayClient

func NewGatewayClient(ctx context.Context, publicKey []byte, hashedPassword string, wireguardListenPort int, log *logrus.Entry) (*GatewayClient, error)

func (*GatewayClient) Bootstrap

func (c *GatewayClient) Bootstrap(ctx context.Context) (*Response, error)

type GatewayRequest

type GatewayRequest struct {
	WireGuardPublicKey []byte `json:"wireguard_public_key"`
	Name               string `json:"name"`
	Endpoint           string `json:"endpoint"`
	HashedPassword     string `json:"hashed_password"`
}

type Handler

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

func NewHandler

func NewHandler(worker Worker, log *logrus.Entry) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Response

type Response struct {
	APIServerGRPCAddress string        `json:"api_server_grpc_address"`
	WireGuardIPv4        string        `json:"wireguard_ip"` // TODO rename to wireguard_ipv4
	WireGuardIPv6        string        `json:"wireguard_ipv6"`
	Peers                []*pb.Gateway `json:"peers"`
}

type Worker

type Worker interface {
	Run(ctx context.Context) error
	Send(ctx context.Context, req *DeviceRequest) (*Response, error)
}

func NewNoopWorker

func NewNoopWorker(ctx context.Context, log *logrus.Entry) Worker

func NewWorker

func NewWorker(ctx context.Context, log *logrus.Entry) (Worker, error)

Jump to

Keyboard shortcuts

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