internal

package
v0.0.0-...-f3738cd Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken = errors.New("token is invalid")
	ErrExpiredToken = errors.New("token has expired")
)

Functions

func NewCli

func NewCli(config *Config, logger *zap.SugaredLogger) *cli.App

Types

type Config

type Config struct {
	Hermes  *HermesConfig
	Mercure *MercureEnvs
}

func GetConfig

func GetConfig() *Config

type HermesConfig

type HermesConfig struct {
	TopicUri     string
	NumEvents    int
	MinWaitTimes int
	MaxWaitTimes int
	ActiveEnv    string
	EventType    string
	PublishOnly  bool
	// contains filtered or unexported fields
}

type JWTMaker

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

func (*JWTMaker) CreateToken

func (m *JWTMaker) CreateToken(sub string, topic string, duration time.Duration, isPublisher bool) (string, error)

func (*JWTMaker) VerifyToken

func (m *JWTMaker) VerifyToken(token string) (*Token, error)

type Maker

type Maker interface {
	CreateToken(sub string, topic string, duration time.Duration, isPublisher bool) (string, error)
	VerifyToken(token string) (*Token, error)
}

func NewJWTMaker

func NewJWTMaker(secretKey string, logger *zap.SugaredLogger) (Maker, error)

type MercureConfig

type MercureConfig struct {
	Name      string `json:"name"`
	HubUrl    string `json:"url"`
	JwtSecret string `json:"jwtSecretKey"`
}

type MercureEnvs

type MercureEnvs struct {
	Envs []MercureConfig `json:"environments"`
}

type Orchestrator

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

func GetDummy

func GetDummy(config *Config, hubUrl string, secret string, logger *zap.SugaredLogger) *Orchestrator

func NewOrchestrator

func NewOrchestrator(config *Config, logger *zap.SugaredLogger) (*Orchestrator, error)

func (*Orchestrator) Run

func (o *Orchestrator) Run(pubHeaders http.Header, subHeaders http.Header)

type Token

type Token struct {
	Mercure map[string][]string `json:"mercure"`
	jwt.StandardClaims
}

func NewPayload

func NewPayload(sub string, topic string, duration time.Duration, isPublisher bool) *Token

func (*Token) Valid

func (p *Token) Valid() error

Jump to

Keyboard shortcuts

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