npoci

package module
v0.0.0-...-29104f3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

README

npoci

Junk drawer of NATS-specific routines and helpers (infrastructure) to speed along Go projects, often proof-of-concepts.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLeafNodeConnectedCount

func CheckLeafNodeConnectedCount(t *testing.T, s *server.Server, lnCons int)

CheckLeafNodeConnectedCount checks that the server has the expected number of leaf node connections

func ClientConnect

func ClientConnect(t testing.TB, s *server.Server, opts ...nats.Option) *nats.Conn

ClientConnect creates a client connection from passed server reference taking optional options e.g. user credentials nats.UserCredentials("path/to/creds") or nats.UserInfo("user", "password")

func ClientConnectURL

func ClientConnectURL(t testing.TB, url string, opts ...nats.Option) *nats.Conn

ClientConnectURL creates a client connection from passed NATS URL taking optional options e.g. user credentials nats.UserCredentials("path/to/creds") or nats.UserInfo("user", "password")

func DefaultOptions

func DefaultOptions() *server.Options

DefaultOptions returns a set of default server options

func GetJsConsumerInfo

func GetJsConsumerInfo(t *testing.T, nc *nats.Conn, stream string, consumer string, apiPrefix string) *server.ConsumerInfo

func GetJsStreamInfo

func GetJsStreamInfo(t *testing.T, nc *nats.Conn, stream string, apiPrefix string) *server.StreamInfo

func GetOCSPStatus

func GetOCSPStatus(s tls.ConnectionState) (*ocsp.Response, error)

func HttpMonitorGetVarz

func HttpMonitorGetVarz(t *testing.T, httpHost string, httpPort int, opts string) *server.Varz

HttpMonitorGetVarz returns the Varz struct from the NATS Server HTTP Monitor endpoint

func JsClientConnect

func JsClientConnect(t *testing.T, s *server.Server, opts ...nats.Option) (*nats.Conn, nats.JetStreamContext)

JsClientConnect creates a client connection and JetStream context from passed server reference taking optional options e.g. user credentials nats.UserCredentials("path/to/creds") or nats.UserInfo("user", "password")

func JsCreateStream

func JsCreateStream(t *testing.T, nc *nats.Conn, stream string, apiPrefix string, jsReq []byte)

func JsCreateStreamFromFile

func JsCreateStreamFromFile(t *testing.T, nc *nats.Conn, stream string, apiPrefix string, jsReqFile string)

func LoadConfig

func LoadConfig(configFile string) (opts *server.Options)

LoadConfig loads a configuration from a filename

func MergeOptions

func MergeOptions(base *server.Options, override *server.Options) (opts *server.Options)

MergeOptions merges two sets of server options, one considered overrides

func NewOCSPResponder

func NewOCSPResponder(t *testing.T, issuerCertPEM, issuerKeyPEM string) *http.Server

func NewOCSPResponderCustomAddress

func NewOCSPResponderCustomAddress(t *testing.T, issuerCertPEM, issuerKeyPEM string, addr string) *http.Server

func NewOCSPResponderDesignatedCustomAddress

func NewOCSPResponderDesignatedCustomAddress(t *testing.T, issuerCertPEM, respCertPEM, respKeyPEM string, addr string) *http.Server

func ParseCertPEM

func ParseCertPEM(t *testing.T, certPEM string) *x509.Certificate

func ParseKeyPEM

func ParseKeyPEM(t *testing.T, keyPEM string) crypto.Signer

func RunServer

func RunServer(opts *server.Options) *server.Server

RunServer starts a new Go Routine based server

func SetOCSPStatus

func SetOCSPStatus(t *testing.T, ocspURL, certPEM string, status int)

func Up

func Up(configFile string) (s *server.Server, opts *server.Options)

Up run an embedded server from a configuration file

func UpByOpts

func UpByOpts(opts *server.Options) (*server.Server, *server.Options)

UpByOpts run an embedded server from passed server options

Types

This section is empty.

Jump to

Keyboard shortcuts

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