natsclient

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

natsclient

client for NATS-enabled D-ISP

Documentation

Index

Constants

View Source
const DefaultServer = "disp-requests"

Variables

This section is empty.

Functions

func ConnectAPI

func ConnectAPI(url, srvtopic string) *nats.Conn

func EntityRegister

func EntityRegister(server, identity, token, roles, groups string, body []byte) (passCd string, status int)

func EntityRetrieve

func EntityRetrieve(server, identity, token string) (resp string, status int)

func InitChannel added in v0.0.9

func InitChannel(server, ch, token string) (string, error)

///////////////////////////////// SECURE CHANNELS ////////////// //

func LoginAPI

func LoginAPI(server, user, passCode string) string

func RelationRegister

func RelationRegister(server, identity, token string) (resp string, status int)

func RelationRetrieve added in v0.0.8

func RelationRetrieve(server, identity, token string) (resp string, status int)

func SCCheck added in v0.0.8

func SCCheck(server, channel, token, rdid string) error

func SecureChannelPublish added in v0.0.8

func SecureChannelPublish(msg []byte, server string, channel string,
	token, rdid string, expireSecs int64) error

func SecureChannelQueueSubscribe added in v0.0.8

func SecureChannelQueueSubscribe(server, channel, queue, token, rdid string, cb nats.MsgHandler) error

func SecureChannelRequest added in v0.0.9

func SecureChannelRequest(server, subj, rdid, token string, data []byte, timeout time.Duration) (*nats.Msg, error)

func SetAspect

func SetAspect(dopts Dopts, val string)

func SetCount

func SetCount(dopts Dopts, val bool)

func SetDomain

func SetDomain(dopts Dopts, val string)

func SetEncryptDataPKey

func SetEncryptDataPKey(dopts Dopts, val string)

func SetEntity

func SetEntity(dopts Dopts, val string)

func SetEntityAccess added in v0.0.2

func SetEntityAccess(dopts Dopts, val string)

func SetGroups

func SetGroups(dopts Dopts, val string)

func SetMatch

func SetMatch(dopts Dopts, val string)

func SetNoHeaders

func SetNoHeaders(dopts Dopts, val bool)

func SetRDID

func SetRDID(dopts Dopts, val string)

func SetRoles

func SetRoles(dopts Dopts, val string)

func SetTag

func SetTag(dopts Dopts, val string)

func SetTimestamp

func SetTimestamp(dopts Dopts, val string)

func SetVal

func SetVal(dopts Dopts, val string)

func SetWithHeaders

func SetWithHeaders(dopts Dopts, val bool)

func SetupSecureChannels added in v0.0.9

func SetupSecureChannels(server string, channelList []string, token string) map[string]string

func SysAdminRegister

func SysAdminRegister(server, identity, passCode, token, roles, groups string) (passCd string, status int)

Types

type Dopts

type Dopts map[string]interface{}

type NATSReqHeader

type NATSReqHeader struct {
	Mode          string                 `json:"mode"`
	Path          string                 `json:"path,omitempty"`
	Flags         map[string]interface{} `json:"flags,omitempty"`
	Authorization string                 `json:"authorization,omitempty"`
	Accept        string                 `json:"accept,omitempty"`
	ReplyTo       string                 `json:"reply_to,omitempty"`
}

type NATSRequest

type NATSRequest struct {
	Header NATSReqHeader `json:"header"`
	Body   []byte        `json:"body"`
}

type NATSResponse

type NATSResponse struct {
	Header   NATSResponseHeader `json:"header"`
	Response string             `json:"response"`
}

func Get

func Get(server string, dopts Dopts, token string) *NATSResponse

func Post

func Post(server string, body []byte, dopts Dopts, token string) *NATSResponse

type NATSResponseHeader

type NATSResponseHeader struct {
	Created      bool   `json:"created,omitempty"`
	Timestamp    int64  `json:"timestamp,omitempty"`
	Path         string `json:"path,omitempty"`
	Doc          string `json:"docId,omitempty"`
	DocVersion   string `json:"docVersion,omitempty"`
	Status       int    `json:"status"`
	ErrorStr     string `json:"error_str,omitempty"`
	ServerID     string `json:"serverID,omitempty"`
	Chunks       int    `json:"chunks,omitempty"`
	EncryptedHdr []byte `json:"encrypted_hdr,omitempty"`
}

type NATSSCData added in v0.0.8

type NATSSCData struct {
	Response queryResponse
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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