Documentation
¶
Index ¶
Constants ¶
View Source
const AuthModeCredsFile = "auth_creds_file"
View Source
const AuthModeJwt = "auth_jwt"
View Source
const AuthModeJwtBearer = "auth_jwt_bearer"
View Source
const AuthModeNKey = "auth_nkey"
View Source
const AuthModeNone = "auth_none"
View Source
const AuthModeToken = "auth_token"
View Source
const AuthModeUserPassword = "auth_user_password"
View Source
const (
CONNECTION_NAME_NUI_PREFIX = "NUI-"
)
View Source
const StatusConnected = "connected"
View Source
const StatusDisconnected = "disconnected"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnBuilder ¶ added in v0.8.0
type ConnBuilder[T Conn] func(connection *Connection) (T, error)
type ConnPool ¶
type ConnPool[T Conn] struct { // contains filtered or unexported fields }
func NewConnPool ¶
func NewConnPool[T Conn](repo ConnRepo, builder ConnBuilder[T]) *ConnPool[T]
func NewNatsConnPool ¶
type ConnRepo ¶
type ConnRepo interface {
All() (map[string]*Connection, error)
GetById(id string) (*Connection, error)
Save(c *Connection) (*Connection, error)
Remove(id string) error
}
type ConnStatusChanged ¶
type Connection ¶
type Connection struct {
Id string `json:"id" `
Name string `json:"name" `
Hosts []string `json:"hosts" `
InboxPrefix string `json:"inbox_prefix"`
Subscriptions []Subscription `clover:"subscriptions" json:"subscriptions"`
Auth []Auth `json:"auth"`
TLSAuth TLSAuth `clover:"tls_auth" json:"tls_auth"`
Metrics Metrics `clover:"metrics" json:"metrics"`
Metadata map[string]string `clover:"metadata" json:"metadata"`
}
func (*Connection) GetMetadata ¶ added in v0.5.0
func (c *Connection) GetMetadata(key string) (string, bool)
func (*Connection) SetMetadata ¶ added in v0.5.0
func (c *Connection) SetMetadata(key, value string)
type DocStoreConnRepo ¶
type DocStoreConnRepo struct {
// contains filtered or unexported fields
}
func NewDocStoreConnRepo ¶
func NewDocStoreConnRepo(db *docstore.DB) *DocStoreConnRepo
func (*DocStoreConnRepo) All ¶
func (r *DocStoreConnRepo) All() (map[string]*Connection, error)
func (*DocStoreConnRepo) GetById ¶
func (r *DocStoreConnRepo) GetById(id string) (*Connection, error)
func (*DocStoreConnRepo) Remove ¶
func (r *DocStoreConnRepo) Remove(id string) error
func (*DocStoreConnRepo) Save ¶
func (r *DocStoreConnRepo) Save(c *Connection) (*Connection, error)
type MemConnRepo ¶
type MemConnRepo struct {
// contains filtered or unexported fields
}
func NewMemConnRepo ¶
func NewMemConnRepo() *MemConnRepo
func (*MemConnRepo) All ¶
func (r *MemConnRepo) All() (map[string]*Connection, error)
func (*MemConnRepo) GetById ¶
func (r *MemConnRepo) GetById(id string) (*Connection, error)
func (*MemConnRepo) Remove ¶
func (r *MemConnRepo) Remove(id string) error
func (*MemConnRepo) Save ¶
func (r *MemConnRepo) Save(c *Connection) (*Connection, error)
type Metrics ¶ added in v0.7.1
type Metrics struct {
HttpSource struct {
Active bool `clover:"active" json:"active"`
Url string `clover:"url" json:"url"`
} `clover:"http_source" json:"http_source"`
NatsSource struct {
Active bool `clover:"active" json:"active"`
Auth Auth `clover:"auth" json:"auth"`
} `clover:"nats_source" json:"nats_source"`
}
type NatsConn ¶
func NatsBuilder ¶ added in v0.8.0
func NatsBuilder(connection *Connection) (*NatsConn, error)
func (*NatsConn) ObserveConnectionEvents ¶
func (n *NatsConn) ObserveConnectionEvents(ctx context.Context) <-chan ConnStatusChanged
type Subscription ¶
type Subscription struct {
Subject string `json:"subject"`
}
Click to show internal directories.
Click to hide internal directories.