nxt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonSerializer      = "json"
	CborSerializer      = "cbor"
	MsgPackSerializer   = "msgpack"
	ProtobufSerializer  = "protobuf"
	CapnprotoSerializer = "capnproto"

	BurstStrategy       = "burst"
	LeakyBucketStrategy = "leakybucket"

	WebSocketTransport = "websocket"
	UniversalTransport = "universal"
	RawSocketTransport = "rawsocket"
)

Variables

View Source
var URIRegex = regexp.MustCompile(`^([^\s.#]+\.)*([^\s.#]+)$`)

Functions

func StartServerFromConfigFile

func StartServerFromConfigFile(configFile string) ([]io.Closer, error)

Types

type Anonymous

type Anonymous struct {
	AuthID string `yaml:"authid"`
	Realm  string `yaml:"realm"`
	Role   string `yaml:"role"`
}

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(authenticators Authenticators) *Authenticator

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(request auth.Request) (auth.Response, error)

func (*Authenticator) Methods

func (a *Authenticator) Methods() []auth.Method

type Authenticators

type Authenticators struct {
	CryptoSign []CryptoSign `yaml:"cryptosign"`
	WAMPCRA    []WAMPCRA    `yaml:"wampcra"`
	Ticket     []Ticket     `yaml:"ticket"`
	Anonymous  []Anonymous  `yaml:"anonymous"`
}

type Config

type Config struct {
	Version string `yaml:"version"`
	Config  struct {
		Loglevel   string `yaml:"loglevel"`
		Management bool   `yaml:"management"`
	} `yaml:"config"`
	Realms         []Realm        `yaml:"realms"`
	Transports     []Transport    `yaml:"transports"`
	Authenticators Authenticators `yaml:"authenticators"`
}

func (Config) Validate

func (c Config) Validate() error

type CryptoSign

type CryptoSign struct {
	AuthID         string   `yaml:"authid"`
	Realm          string   `yaml:"realm"`
	Role           string   `yaml:"role"`
	AuthorizedKeys []string `yaml:"authorized_keys"`
}

type Permission

type Permission struct {
	URI            string `yaml:"uri"`
	MatchPolicy    string `yaml:"match"`
	AllowCall      bool   `yaml:"allow_call"`
	AllowPublish   bool   `yaml:"allow_publish"`
	AllowRegister  bool   `yaml:"allow_register"`
	AllowSubscribe bool   `yaml:"allow_subscribe"`
}

type RateLimit

type RateLimit struct {
	Rate     uint   `yaml:"rate"`
	Interval int    `yaml:"interval"`
	Strategy string `yaml:"strategy"`
}

type Realm

type Realm struct {
	Name  string      `yaml:"name"`
	Roles []RealmRole `yaml:"roles"`
}

type RealmRole

type RealmRole struct {
	Name        string       `yaml:"name"`
	Permissions []Permission `yaml:"permissions"`
}

type Ticket

type Ticket struct {
	AuthID string `yaml:"authid"`
	Realm  string `yaml:"realm"`
	Role   string `yaml:"role"`
	Ticket string `yaml:"ticket"`
}

type Transport

type Transport struct {
	Type        string        `yaml:"type"`
	Address     string        `yaml:"address"`
	Listener    xconn.Network `yaml:"listener"`
	Serializers []string      `yaml:"serializers"`
	RateLimit   RateLimit     `yaml:"ratelimit"`
}

type WAMPCRA

type WAMPCRA struct {
	AuthID     string `yaml:"authid"`
	Realm      string `yaml:"realm"`
	Role       string `yaml:"role"`
	Secret     string `yaml:"secret"`
	Salt       string `yaml:"salt"`
	Iterations int    `yaml:"iterations"`
	KeyLen     int    `yaml:"keylen"`
}

Jump to

Keyboard shortcuts

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