router

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver added in v1.2.0

type Driver interface {
	WriteSession(ctx context.Context, session types.PocketSession) error
	WriteRegion(ctx context.Context, region types.PortalRegion) error
	WriteRelay(ctx context.Context, relay types.Relay) error
	ReadRelay(ctx context.Context, relayID int) (types.Relay, error)
	WriteServiceRecord(ctx context.Context, serviceRecord types.ServiceRecord) error
	ReadServiceRecord(ctx context.Context, serviceRecordID int) (types.ServiceRecord, error)
}

type MockDriver added in v1.2.0

type MockDriver struct {
	mock.Mock
}

MockDriver is an autogenerated mock type for the Driver type

func (*MockDriver) ReadRelay added in v1.2.0

func (_m *MockDriver) ReadRelay(ctx context.Context, relayID int) (types.Relay, error)

ReadRelay provides a mock function with given fields: ctx, relayID

func (*MockDriver) ReadServiceRecord added in v1.33.0

func (_m *MockDriver) ReadServiceRecord(ctx context.Context, serviceRecordID int) (types.ServiceRecord, error)

ReadServiceRecord provides a mock function with given fields: ctx, serviceRecordID

func (*MockDriver) WriteRegion added in v1.2.0

func (_m *MockDriver) WriteRegion(ctx context.Context, region types.PortalRegion) error

WriteRegion provides a mock function with given fields: ctx, region

func (*MockDriver) WriteRelay added in v1.2.0

func (_m *MockDriver) WriteRelay(ctx context.Context, relay types.Relay) error

WriteRelay provides a mock function with given fields: ctx, relay

func (*MockDriver) WriteServiceRecord added in v1.33.0

func (_m *MockDriver) WriteServiceRecord(ctx context.Context, serviceRecord types.ServiceRecord) error

WriteServiceRecord provides a mock function with given fields: ctx, serviceRecord

func (*MockDriver) WriteSession added in v1.2.0

func (_m *MockDriver) WriteSession(ctx context.Context, session types.PocketSession) error

WriteSession provides a mock function with given fields: ctx, session

type Router

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

func NewRouter

func NewRouter(driver Driver, apiKeys map[string]bool, port string, relayBatch *batch.Batch[*types.Relay], serviceRecordBatch *batch.Batch[*types.ServiceRecord], logger *zap.Logger) (*Router, error)

NewRouter returns router instance

func (*Router) AuthorizationHandler

func (rt *Router) AuthorizationHandler(h http.Handler) http.Handler

func (*Router) CreateRegion

func (rt *Router) CreateRegion(w http.ResponseWriter, r *http.Request)

func (*Router) CreateRelay

func (rt *Router) CreateRelay(w http.ResponseWriter, r *http.Request)

func (*Router) CreateRelays added in v1.7.0

func (rt *Router) CreateRelays(w http.ResponseWriter, r *http.Request)

func (*Router) CreateServiceRecord added in v1.33.0

func (rt *Router) CreateServiceRecord(w http.ResponseWriter, r *http.Request)

func (*Router) CreateServiceRecords added in v1.33.0

func (rt *Router) CreateServiceRecords(w http.ResponseWriter, r *http.Request)

func (*Router) CreateSession

func (rt *Router) CreateSession(w http.ResponseWriter, r *http.Request)

func (*Router) GetRelay

func (rt *Router) GetRelay(w http.ResponseWriter, r *http.Request)

func (*Router) GetServiceRecord added in v1.33.0

func (rt *Router) GetServiceRecord(w http.ResponseWriter, r *http.Request)

func (*Router) HealthCheck

func (rt *Router) HealthCheck(w http.ResponseWriter, r *http.Request)

func (*Router) RunServer added in v1.2.0

func (rt *Router) RunServer(ctx context.Context)

Jump to

Keyboard shortcuts

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