natsclient

package module
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

natsclient

client for NATS-enabled D-ISP

Documentation

Index

Constants

View Source
const DefaultServer = "disp-requests"

Variables

View Source
var (
	SessionKey    *ecc.KeyPair
	SessionPubKey string
	ServerKey     *ecc.KeyPair
	ServerPubKey  string // sent to server calls for encryption of result message
	ServerToken   APIToken
	// set in APILogin call
	DPSessKeyCache *cache.Cache
)

Functions

func ConnectAPI

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

func EntityRegister

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

func EntityRemove added in v0.0.17

func EntityRemove(server, identity string, token APIToken) (resp string, status int)

func EntityRetrieve

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

func EntityUpdate added in v0.0.16

func EntityUpdate(server, identity string, token APIToken, body []byte) (resp string, status int)

func GenKey added in v0.0.11

func GenKey() *ecc.KeyPair

func GetSessionKey added in v0.0.11

func GetSessionKey(token string) *ecc.KeyPair

func InitChannel added in v0.0.9

func InitChannel(server, ch string, token APIToken, create bool) (string, error)

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

func RelationRegister

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

func RelationRemove added in v0.0.18

func RelationRemove(server, identity string, token APIToken) (resp string, status int)

func RelationRetrieve added in v0.0.8

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

func SCCheckAndResolve added in v0.0.11

func SCCheckAndResolve(server, channel string, token APIToken, rdid string) (string, error)

func SecureChannelPublish added in v0.0.8

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

func SecureChannelQueueSubscribe added in v0.0.8

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

func SecureChannelRequest added in v0.0.9

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

func SetAspect

func SetAspect(dopts Dopts, val string)

func SetContentType added in v0.0.11

func SetContentType(dopts Dopts, val string)

func SetCount

func SetCount(dopts Dopts, val string)

func SetDocId added in v0.0.11

func SetDocId(dopts Dopts, val string)

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 SetExpiry added in v0.0.11

func SetExpiry(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 string)

func SetRDID

func SetRDID(dopts Dopts, val string)

func SetRoles

func SetRoles(dopts Dopts, val string)

func SetSecureHeader added in v0.0.20

func SetSecureHeader(dopts Dopts, val string)

func SetTag

func SetTag(dopts Dopts, val string)

func SetTemplateClass added in v0.0.29

func SetTemplateClass(dopts Dopts, val string)

func SetTemplateIDs added in v0.0.28

func SetTemplateIDs(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 string)

func SetupSecureChannels added in v0.0.9

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

func SysAdminRegister

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

func TemplateRegister added in v0.0.23

func TemplateRegister(server, tname, tclass, tsource string, token APIToken) (resp string, status int)

func TemplateRetrieve added in v0.0.23

func TemplateRetrieve(server, tname, tclass string, token APIToken) (resp string, status int)

Types

type ACTemplate added in v0.0.24

type ACTemplate struct {
	Template header `json:"template"`
}

type APIToken added in v0.0.11

type APIToken struct {
	Token   string `json:"token"`
	SPubKey string `json:"pubKey"`
}

func LoginAPI

func LoginAPI(server, user, passCode string) APIToken

type CFSLConfig added in v0.0.11

type CFSLConfig struct {
	User string `json:"user"`
	//Token        APIToken `json:"token"`
	Company      string `json:"company"`
	Email        string `json:"email"`
	Os           string `json:"os"`
	Expiration   uint64 `json:"expiration"`
	License      string `json:"license"`
	ServerType   string `json:"serverType"`
	MaxInstances int    `json:"maxinstances"`
	MaxFSMemory  int    `json:"maxfsmemory"`
	MaxNumFS     int    `json:"maxnumFS"`
}

func CFSInit added in v0.0.11

func CFSInit(server string, body []byte) *CFSLConfig

func GetCFSLicense added in v0.0.11

func GetCFSLicense(server string, token APIToken, body []byte) *CFSLConfig

type Dopts

type Dopts map[string]interface{}

type NATSReqHeader

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

type NATSRequest

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

type NATSResponse

type NATSResponse struct {
	Header   NATSResponseHeader `json:"header"`
	Response []byte             `json:"response"`
}

func Get

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

func Post

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

func SessionKeyNilError added in v0.0.11

func SessionKeyNilError() *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 {
}

type TokenKeyCache added in v0.0.11

type TokenKeyCache struct {
	Token   string
	SessKey *ecc.KeyPair
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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