natsconf

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: Apache-2.0 Imports: 2 Imported by: 10

Documentation

Overview

natsconf is a package for producing NATS config programmatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(conf *ServerConfig) ([]byte, error)

Marshal takes a server configuration and returns its JSON representation in bytes.

Types

type AuthorizationConfig

type AuthorizationConfig struct {
	Username           string       `json:"username,omitempty"`
	Password           string       `json:"password,omitempty"`
	Token              string       `json:"token,omitempty"`
	Timeout            int          `json:"timeout,omitempty"`
	Users              []*User      `json:"users,omitempty"`
	DefaultPermissions *Permissions `json:"default_permissions,omitempty"`
}

type ClusterConfig

type ClusterConfig struct {
	Port          int                  `json:"port,omitempty"`
	Routes        []string             `json:"routes,omitempty"`
	TLS           *TLSConfig           `json:"tls,omitempty"`
	Authorization *AuthorizationConfig `json:"authorization,omitempty"`
}

type Permissions added in v0.2.2

type Permissions struct {
	Publish   []string `json:"publish,omitempty"`
	Subscribe []string `json:"subscribe,omitempty"`
}

Permissions are the allowed subjects on a per publish or subscribe basis.

type ServerConfig

type ServerConfig struct {
	Host           string               `json:"host,omitempty"`
	Port           int                  `json:"port,omitempty"`
	HTTPPort       int                  `json:"http_port,omitempty"`
	Cluster        *ClusterConfig       `json:"cluster,omitempty"`
	TLS            *TLSConfig           `json:"tls,omitempty"`
	Debug          bool                 `json:"debug,omitempty"`
	Trace          bool                 `json:"trace,omitempty"`
	WriteDeadline  string               `json:"write_deadline,omitempty"`
	MaxConnections int                  `json:"max_connections,omitempty"`
	MaxPayload     int                  `json:"max_payload,omitempty"`
	Authorization  *AuthorizationConfig `json:"authorization,omitempty"`
}

type TLSConfig

type TLSConfig struct {
	CAFile           string   `json:"ca_file,omitempty"`
	CertFile         string   `json:"cert_file,omitempty"`
	KeyFile          string   `json:"key_file,omitempty"`
	Verify           bool     `json:"verify,omitempty"`
	CipherSuites     []string `json:"cipher_suites,omitempty"`
	CurvePreferences []string `json:"curve_preferences,omitempty"`
	Timeout          float64  `json:"timeout,omitempty"`
}

type User added in v0.2.2

type User struct {
	User        string       `json:"username,omitempty"`
	Password    string       `json:"password,omitempty"`
	Permissions *Permissions `json:"permissions,omitempty"`
}

Jump to

Keyboard shortcuts

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