subscriber

package
v0.0.0-...-ec04216 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a utility for receiving wireguard key events from a message-queue server

func New

func New(url string, options ...ClientOption) *Client

func (*Client) Subscribe

func (s *Client) Subscribe(ctx context.Context, channel chan<- Event) error

Subscribe establishes a websocket connection for a message-queue channel, and emits messages on the given channel

type ClientOption

type ClientOption func(s *Client)

func WithAPIKey

func WithAPIKey(apiKey fvpn.APIKey) ClientOption

func WithBasicAuth

func WithBasicAuth(username, password string) ClientOption

func WithHeader

func WithHeader(key, val string) ClientOption

type Event

type Event struct {
	ID         string        `json:"id,omitempty"`
	Object     string        `json:"object,omitempty"`
	APIVersion string        `json:"version,omitempty"`
	Type       string        `json:"type,omitempty"`
	Request    *EventRequest `json:"request,omitempty"`
	Data       *EventData    `json:"data,omitempty"`
}

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

type EventData

type EventData struct {
	Object any `json:"object,omitempty"`
}

type EventRequest

type EventRequest struct {
	ID             string `json:"id,omitempty"`
	IdempotencyKey string `json:"idempotency_key,omitempty"`
}

Jump to

Keyboard shortcuts

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