app

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelpRequested added in v1.0.5

func HelpRequested() (help bool)

HelpRequested returns true if any of the common types of help invocation are found as the first command line parameter/flag.

func NewConfig added in v1.0.5

func NewConfig() (cfg *Config, err E)

func PrintHelp added in v1.0.5

func PrintHelp(cfg *Config, printer io.Writer) (s string)

PrintHelp outputs a help text listing the configuration options and default values to a provided io.Writer (usually os.Stderr or os.Stdout).

Types

type B added in v1.0.5

type B = []byte

type Config added in v1.0.5

type Config struct {
	AppName      S    `env:"APP_NAME" default:"realy"`
	Root         S    `env:"ROOT_DIR" usage:"root path for all other path configurations (defaults OS user home if empty)"`
	Profile      S    `env:"PROFILE" default:".realy" usage:"name of directory in root path to store relay state data and database"`
	Listen       S    `env:"LISTEN" default:"0.0.0.0" usage:"network listen address"`
	Port         N    `env:"PORT" default:"3334" usage:"port to listen on"`
	AdminListen  S    `env:"ADMIN_LISTEN" default:"127.0.0.1" usage:"admin listen address"`
	AdminPort    N    `env:"ADMIN_PORT" default:"3337" usage:"admin listen port"`
	LogLevel     S    `env:"LOGLEVEL" default:"info" usage:"debug level: fatal error warn info debug trace"`
	AuthRequired bool `env:"AUTH_REQUIRED" default:"false" usage:"requires auth for all access"`
	Moderators   []S  `env:"MODERATORS" usage:"list of npubs of users whose follow and mute list dictate accepting requests and events"`
}

type Ctx added in v1.0.5

type Ctx = context.T

type E added in v1.0.5

type E = error

type N added in v1.0.5

type N = int

type Relay

type Relay struct {
	*Config
	Store store.I
}

func (*Relay) AcceptEvent

func (r *Relay) AcceptEvent(c context.T, evt *event.T, hr *http.Request, authedPubkey B) bool

func (*Relay) AcceptReq

func (r *Relay) AcceptReq(c Ctx, hr *http.Request, id B, ff *filters.T, authedPubkey B) bool

func (*Relay) AuthEnabled

func (r *Relay) AuthEnabled() bool

func (*Relay) Init

func (r *Relay) Init() E

func (*Relay) Name

func (r *Relay) Name() S

func (*Relay) ServiceUrl

func (r *Relay) ServiceUrl(req *http.Request) (s S)

ServiceUrl returns the address of the relay to send back in auth responses. If auth is disabled this returns an empty string.

func (*Relay) Storage

func (r *Relay) Storage(c context.T) store.I

type S added in v1.0.5

type S = string

Jump to

Keyboard shortcuts

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