server

package
v0.0.0-...-b804bf3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

+build:apihttp

Index

Constants

View Source
const (
	ConfigName       = "server"
	DefaultPortHTTP2 = 8402
	DefaultPortHTTP1 = 8401
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuthz

type APIKeyAuthz struct {
	APIKeyHandler
}

func NewAPIKeyAuthz

func NewAPIKeyAuthz(cfg *Config) APIKeyAuthz

func (*APIKeyAuthz) ServeHTTP

func (a *APIKeyAuthz) ServeHTTP(w http.ResponseWriter, r *http.Request)

type APIKeyCreator

type APIKeyCreator struct {
	APIKeyHandler
	apibin.APIKeyStoreServer
}

func NewAPIKeyCreator

func NewAPIKeyCreator(cfg *Config) APIKeyCreator

func (*APIKeyCreator) Create

func (*APIKeyCreator) ServeHTTP

func (a *APIKeyCreator) ServeHTTP(w http.ResponseWriter, r *http.Request)

type APIKeyHandler

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

func NewAPIKeyHandler

func NewAPIKeyHandler(cfg *Config) APIKeyHandler

func (*APIKeyHandler) EnsureConnected

func (h *APIKeyHandler) EnsureConnected(ctx context.Context) error

func (*APIKeyHandler) ForceReconnect

func (h *APIKeyHandler) ForceReconnect(ctx context.Context) error

type ClientCollection

type ClientCollection struct {
	APIKeyHandler
}

func NewClientCollection

func NewClientCollection(cfg *Config) ClientCollection

func (*ClientCollection) ServeHTTP

func (cc *ClientCollection) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ClientRecord

type ClientRecord struct {
	apikeys.Key
	DisplayName string `firestore:"display_name"`
	Audience    string `firestore:"aud"`
	Scope       string `firestore:"scope"`
}

func (*ClientRecord) MarshalJSON

func (cr *ClientRecord) MarshalJSON() ([]byte, error)

MarshalJSON ensures that derived_key is marshaled as url safe form for consistency with how the parts of the apikeys are serialized

func (*ClientRecord) UnmarshalJSON

func (cr *ClientRecord) UnmarshalJSON(data []byte) error

type Config

type Config struct {
	Mode          string
	ProjectID     string
	Address1      string
	Address2      string
	Prefix        string
	ExchangeURL   string
	ClientID      string
	ClientSecret  string
	ShutdownGrace time.Duration
	WriteTimeout  time.Duration
	ReadTimeout   time.Duration
	IdleTimeout   time.Duration
}

func NewConfig

func NewConfig() Config

type Option

type Option func(*Server)

type Server

type Server struct {
	ConfigFileDir string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	ctx context.Context, configFileDir string, cfg *Config, opts ...Option) (Server, error)

func (*Server) Serve

func (s *Server) Serve()

Jump to

Keyboard shortcuts

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