Documentation
¶
Index ¶
- Constants
- Variables
- func CalcPushCostMAtoms(minPushPayment, payRateMAtoms, payRateBytes, sizeBytes uint64) (int64, error)
- func CalcRTDTSessPushMAtoms(joinRate, payRateMAtoms, payRateMB uint64, sessMB, sessSize uint32) (int64, error)
- func CalcRTDTSessPushMB(joinRate, payRateMAtoms, payRateMB uint64, sessSize uint32, paidMAtoms int64) (uint32, error)
- func ComposeCompressedRM(fromSigner MessageSigner, rm interface{}, zlibLevel int) ([]byte, error)
- func ComposeCompressedRMWithHeader(fromSigner MessageSigner, h RMHeader, rm interface{}, zlibLevel int) ([]byte, error)
- func ComposeRM(fromSigner MessageSigner, rm interface{}) ([]byte, error)
- func ComposeRMO(rm interface{}, zlibLevel int) ([]byte, error)
- func DecryptOOB(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, ...) (interface{}, error)
- func EncryptRMO(x interface{}, theirKey *zkidentity.FixedSizeSntrupPublicKey, zlibLevel int) ([]byte, error)
- func EstimateRoutedRMWireSize(compressedRMSize int) int
- func IsPostStatus(attrs map[string]string) bool
- func MarshalOOBPublicIdentityInvite(pii *OOBPublicIdentityInvite) ([]byte, error)
- func MaxMsgSizeForVersion(v MaxMsgSizeVersion) uint
- func MaxPayloadSizeForVersion(v MaxMsgSizeVersion) uint
- func NewFullRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, ...) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
- func NewHalfRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, ...) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
- func ParseErrUnpaidSubscriptionRV(s string) error
- func SetLog(v slog.Logger)
- func ZLibDecode(in []byte, maxDecompressSize uint) ([]byte, error)
- type Acknowledge
- type AppointRTDTServer
- type AppointRTDTServerReply
- type CreateRTDTSession
- type CreateRTDTSessionReply
- type ErrUnpaidSubscriptionRV
- type FileManifest
- type FileMetadata
- type GetInvoice
- type GetInvoiceAction
- type GetInvoiceReply
- type GetRTDTAppointCookies
- type GetRTDTAppointCookiesReply
- type InviteFunds
- type MaxMsgSizeVersion
- type Message
- type MessageMode
- type MessageSigner
- type MessageVerifier
- type OOBPublicIdentityInvite
- func CreateOOBPublicIdentityInvite(pi zkidentity.PublicIdentity) (*OOBPublicIdentityInvite, error)
- func DecryptOOBPublicIdentityInvite(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, ...) (*OOBPublicIdentityInvite, error)
- func UnmarshalOOBPublicIdentityInviteFile(filename string) (*OOBPublicIdentityInvite, error)
- type Ping
- type Pong
- type PostListItem
- type PostMetadata
- type PostMetadataStatus
- type PushRoutedMessage
- type RMBlock
- type RMFTGet
- type RMFTGetChunk
- type RMFTGetChunkReply
- type RMFTGetReply
- type RMFTList
- type RMFTListReply
- type RMFTPayForChunk
- type RMFTSendFile
- type RMFetchResource
- type RMFetchResourceReply
- type RMGetInvoice
- type RMGetPost
- type RMGroupInvite
- type RMGroupJoin
- type RMGroupKick
- type RMGroupKill
- type RMGroupList
- type RMGroupMessage
- type RMGroupPart
- type RMGroupUpdateAdmins
- type RMGroupUpgradeVersion
- type RMHandshakeACK
- type RMHandshakeSYN
- type RMHandshakeSYNACK
- type RMHeader
- type RMInvite
- type RMInvoice
- type RMKXSearch
- type RMKXSearchRef
- type RMKXSearchRefType
- type RMKXSearchReply
- type RMKXSuggestion
- type RMListPosts
- type RMListPostsReply
- type RMMediateIdentity
- type RMOFullKX
- type RMOHalfKX
- type RMOHeader
- type RMPostGet
- type RMPostGetReply
- type RMPostShare
- type RMPostStatus
- type RMPostStatusReply
- type RMPostsSubscribe
- type RMPostsSubscribeReply
- type RMPostsUnsubscribe
- type RMPostsUnsubscribeReply
- type RMPrivateMessage
- type RMProfileUpdate
- type RMRTDTAdminCookies
- type RMRTDTAdminMember
- type RMRTDTDissolveSession
- type RMRTDTExitSession
- type RMRTDTRemovedFromSession
- type RMRTDTRotateAppointCookie
- type RMRTDTSession
- type RMRTDTSessionInvite
- type RMRTDTSessionInviteAccept
- type RMRTDTSessionInviteCancel
- type RMRTDTSessionPublisher
- type RMReceiptDomain
- type RMReceiveReceipt
- type RMResourceBundle
- type RMTransitiveMessage
- type RMTransitiveMessageForward
- type RMTransitiveMessageReply
- type RMTransitiveReset
- type RMTransitiveResetReply
- type RMUser
- type RMUserReply
- type RTDTAppointCookie
- type RTDTAppointmentCookiePeer
- type RTDTDataPacket
- type RTDTFramedPacket
- type RTDTJoinCookie
- type RTDTPeerID
- type RTDTPingCmd
- type RTDTPongCmd
- type RTDTRotateCookie
- type RTDTServerCmdJoinSession
- type RTDTServerCmdJoinSessionReply
- type RTDTServerCmdKickPeer
- type RTDTServerCmdKickPeerReply
- type RTDTServerCmdLeaveSession
- type RTDTServerCmdLeaveSessionReply
- type RTDTServerCmdMembersBitmap
- func (c *RTDTServerCmdMembersBitmap) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
- func (c *RTDTServerCmdMembersBitmap) DecodeBitmap(bmp *roaring.Bitmap) error
- func (c *RTDTServerCmdMembersBitmap) FromBytes(b []byte) error
- func (c *RTDTServerCmdMembersBitmap) ToBitmap() (*roaring.Bitmap, error)
- type RTDTServerCmdRotateSessionCookies
- type RTDTServerCmdRotateSessionCookiesReply
- type RTDTServerCmdType
- type RTDTSessionCookie
- type RTDTStreamType
- type ResourceStatus
- type ResourceTag
- type RouteMessage
- type RouteMessageReply
- type SeederClientAPI
- type SeederCommandStatus
- type SeederCommandStatusDB
- type SeederCommandStatusNode
- type SeederCommandStatusReply
- type SeederServerGroup
- type ServerProperty
- type SubscribeRoutedMessages
- type SubscribeRoutedMessagesReply
- type SuggestedClientVersion
- type TxHash
- type Welcome
Constants ¶
const ( RMHeaderVersion = 1 // Use NoCompression by default RMDefaultCompressionLevel = zlib.NoCompression )
Header that describes the payload that follows.
const ( RMCPrivateMessage = "pm" RMPrivateMessageModeNormal = 0 RMPrivateMessageModeMe = 1 // XXX not rigged up yet )
Private message to other client
const ( ResourceStatusOk = 200 ResourceStatusBadRequest = 400 ResourceStatusNotFound = 404 ResourceMetaResponseIsBundle = "IsBundle" ResourceMetaResponseIsBundleValue = "1" )
const ( RMCHandshakeSYN = "handshakesyn" RMCHandshakeSYNACK = "handshakesynack" RMCHandshakeACK = "handshakeack" )
const ( RMCFTList = "ftls" RMFTDGlobal = "global" // Globally accessible files )
const ( RMUDescription = "description" // User description RMUAway = "away" // User away message RMUProfilePicture = "profilepicture" // User profile picture )
const ( RMPSHeart = "heart" // Heart a post RMPSComment = "comment" // Comment on a post RMPSHeartYes = "1" // +1 heart RMPSHeartNo = "0" // -1 heart )
const ( RMPVersion = "version" // Post version RMPIdentifier = "identifier" // Post identifier RMPDescription = "description" // Post description RMPMain = "main" // Main post body RMPTitle = "title" // Title of the post RMPAttachment = "attachment" // Attached file to the post RMPStatusFrom = "statusfrom" // Status/post update from (author) RMPSignature = "signature" // Signature for the post/status RMPParent = "parent" // Parent status/post RMPStatusID = "statusid" // Status ID in status updates RMPNonce = "nonce" // Random nonce to avoid equal hashes RMPFromNick = "from_nick" // Nick of origin for post/status RMPTimestamp = "timestamp" // Timestamp of the status update )
const ( // pre session phase InitialCmdIdentify = "identify" InitialCmdSession = "session" // session phase SessionCmdWelcome = "welcome" // tagged server commands TaggedCmdAcknowledge = "ack" TaggedCmdPing = "ping" TaggedCmdPong = "pong" // payment cmds TaggedCmdGetInvoice = "getinvoice" TaggedCmdGetInvoiceReply = "getinvoicereply" TaggedCmdRouteMessage = "routemessage" TaggedCmdRouteMessageReply = "routemessagereply" TaggedCmdSubscribeRoutedMessages = "subscriberoutedmessages" TaggedCmdSubscribeRoutedMessagesReply = "subscriberoutedmessagesreply" TaggedCmdPushRoutedMessage = "pushroutedmessage" // PRPC RTDT commands TaggedCmdCreateRTDTSession = "creatertdtsess" TaggedCmdCreateRTDTSessionReply = "creatertdtsessreply" TaggedCmdGetRTDTAppointCookie = "getrtdtapptcookie" TaggedCmdGetRTDTAppointCookieReply = "getrtdtapptcookiereply" TaggedCmdAppointRTDTServer = "appointrtdtserver" TaggedCmdAppointRTDTServerReply = "appointrtdtserverreply" // misc MessageModeNormal MessageMode = 0 MessageModeMe MessageMode = 1 PaySchemeFree = "free" PaySchemeDCRLN = "dcrln" // PingLimit is how long to wait for a ping before disconnect. // DefaultPingInterval is how long to wait to send the next ping. DefaultPingInterval = 30 * time.Second // MaxChunkSize is the maximum size of a file chunk used in file // downloads. MaxChunkSize = 1024 * 1024 // 1 MiB // MinRMPushPayment is the minimum payment amount required to push a payment // to the server (in milliatoms). MinRMPushPayment uint64 = 1000 // InvoiceExpiryAffordance is the time before the expiry a client may // request a new invoice. InvoiceExpiryAffordance = 15 * time.Second // PublishFreePayRTPublishAllowanceMB is how many megabytes can be // published per publish allowance request when using the free payment // scheme. PublishFreePayRTPublishAllowanceMB = 1 // WARNING: MUST match what is set in rtdtsessmanager.go or E2E tests fail. )
const ( // Tag Depth is a required property. It defines maximum outstanding // commands. PropTagDepth = "tagdepth" PropTagDepthDefault = "10" // Server Time is a required property. It contains the server time // stamp. The client shall warn the user if the client is not time // synced. Clients and proxies really shall run NTP. PropServerTime = "servertime" // Payment Scheme is a required property. It defines whether the type // of payment that the server expects before routing messages. PropPaymentScheme = "payscheme" PropPaymentSchemeDefault = "free" // Push Payment rate is the required payment rate to push RMs when the // payment scheme is not free (in milli-atoms per pay rate units). PropPushPaymentRate = "pushpayrate" PropPushPaymentRateDefault = 100 // MilliAtoms/PropPushPaymentRateBytes // PropPushPaymentRateBytes is the unit in which the push payment rate // is specified (i.e. how many bytes per payment rate). PropPushPaymentRateBytes = "pushpayratebytes" PropPushPaymentRateBytesDefault = 1 // In bytes // PropPushPaymentRateMinMAtoms is the min number of milliatoms to pay // for each push. PropPushPaymentRateMinMAtoms = "pushpayrateminmatoms" PropPushPaymentRateMinMAtomsDefault = MinRMPushPayment // Sub payment rate is the required payment rate to sub to RVs when the // payment scheme is not free (in milli-atoms per byte). PropSubPaymentRate = "subpayrate" PropSubPaymentRateDefault = 1000 // MilliAtoms/sub // PropServerLNNode returns the node id of the server. PropServerLNNode = "serverlnnode" // PropExpirationDays is the number of days after which data is expired // from the server automatically. PropExpirationDays = "expirationdays" PropExpirationDaysDefault = 7 // PropPushPaymentLifetime is the maximum duration when a successful // payment for a push may be redeemed. After this duration, the push // needs to be paid for again. This value is in seconds. PropPushPaymentLifetime = "pushpaymentlifetime" PropPushPaymentLifetimeDefault = 60 * 60 * 24 // 24 hours // PropMaxPushInvoices is the maximum number of outstanding (unredeemed) // push invoices a connected client may request before needing to pay // for them. PropMaxPushInvoices = "maxpushinvoices" PropMaxPushInvoicesDefault = 8 // PropMaxMsgSizeVersion is the max message size version supported by // the server. PropMaxMsgSizeVersion = "maxmsgsizeversion" PropMaxMsgSizeVersionDefault = MaxMsgSizeV0 // PropPingLimit is the ping limit the server expects, after which it // will disconnect a client. PropPingLimit = "pinglimit" PropPingLimitDefault = 5 * time.Minute // PropSuggestClientVersions is a list of client versions suggested by // the server. PropSuggestClientVersions = "clientversions" )
const ( PropRTMAtomsPerSess = "rtmatomspersess" PropRTMAtomsPerUserSess = "rtmatomsperusersess" PropRTMAtomsGetCookie = "rtmatomsgetcookie" PropRTMAtomsPerUserGetCookie = "rtmatomsgetcookieuser" PropRTMAtomsJoin = "rtmatomsjoin" PropRTMAtomsPushRate = "rtmatomspushrate" PropRTPushRateMBytes = "rtpushratembytes" )
const ( // RTDTMaxMessageSize is the max size of a full UDP RTDT message. RTDTMaxMessageSize = 65535 // RTDTMaxPingInterval is the max interval between receiving pings (or // other data) messages. RTDTMaxPingInterval = time.Second * 60 // RTDTDefaultPingInterval is the default interval used by the client // to send ping messages. RTDTDefaultPingInterval = time.Second * 45 // RTDTDefaultMinPingInterval is the minimum interval between pings (any // lower and the RTDT server disconnects the client). RTDTDefaultMinPingInterval = time.Second * 5 // RTDTMaxPingPayloadSize is the maximum size of the payload in a ping // message (in bytes). RTDTMaxPingPayloadSize = 256 )
const FileMetadataVersion = 1
const OOBCPublicIdentityInvite = "oobpublicidentityinvite"
const PostMetadataStatusVersion = 1
const PostMetadataVersion = 1
const (
ProtocolVersion = 10
)
const RMCBlock = "block"
const RMCFTGet = "ftget"
const RMCFTGetChunk = "ftgetchunk"
const RMCFTGetChunkReply = "ftgetchunkreply"
const RMCFTGetReply = "ftgetreply"
const RMCFTListReply = "ftlsreply"
const RMCFTPayForChunk = "ftpayforchunk"
const RMCFTSendFile = "ftsendfile"
const RMCFetchResource = "fetchresource"
const RMCFetchResourceReply = "fetchresourcereply"
const RMCGetInvoice = "getinvoice"
const RMCGetPost = "getpost"
const RMCGroupInvite = "groupinvite"
const RMCGroupJoin = "groupjoin"
const RMCGroupKick = "groupkick"
const RMCGroupKill = "groupkill"
const RMCGroupList = "grouplist"
const RMCGroupMessage = "groupmessage"
const RMCGroupPart = "grouppart"
const RMCGroupUpgradeVersion = "groupupversion"
const RMCInvite = "invite"
const RMCInvoice = "invoice"
const RMCKXSearch = "kxsearch"
const RMCKXSearchReply = "kxsearchreply"
const RMCKXSuggestion = "kxsuggestion"
const RMCListPosts = "listposts"
const RMCListPostsReply = "listpostsreply"
const RMCMediateIdentity = "mediateidentity"
const RMCPostGet = "postget"
const RMCPostGetReply = "postgetreply"
const RMCPostStatus = "poststatus"
const RMCPostStatusReply = "poststatusreply"
const RMCPostsSubscribe = "postssubscribe"
const RMCPostsSubscribeReply = "postssubscribereply"
const RMCPostsUnsubscribe = "postsunsubscribe"
const RMCPostsUnsubscribeReply = "postsunsubscribereply"
const RMCProfileUpdate = "profileupdt"
RMCProfileUpdate is the command for a RMProfileUpdate.
const RMCRTDTAdminCookies = "rtdtadmincookies"
RMCRTDTAdminCookies is the command for the RMRTDTAdminCookies C2C message.
const RMCRTDTDissolveSesssion = "rtdtdisssess"
RMCRTDTDissolveSession is the command for the RMRTDTDissolveSession C2C meessage.
const RMCRTDTExitSesssion = "rtdtexitsess"
RMCRTDTExitSession is the command for the RMRTDTExitSession C2C meessage.
const RMCRTDTRemovedFromSession = "rtdtremovedfromsess"
RMCRTDTRemovedFromSession is the command for the RMRTDTRemovedFromSession C2C meessage.
const RMCRTDTRotateAppointCookie = "rtdtrotappointcookie"
RMCRTDTRotateAppointCookie is the command for the RMRTDTRotateAppointCookie C2C meessage.
const RMCRTDTSession = "rtdtsession"
RMCRTDTSession is the command for the RMRTDTSession C2C meessage.
const RMCRTDTSessionInvite = "rtdtsessinvite"
RMCRTDTSessionInvite is the command for the RMRTDTSessionInvite C2C message.
const RMCRTDTSessionInviteAccept = "rtdtsessinviteaccept"
RMCRTDTSessionInviteAccept is the command for the RMRTDTSessionPublisher C2C message.
const RMCRTDTSessionInviteCancel = "rtdtsessinvitecancel"
RMCRTDTSessionInviteCancel is the command for the RMRTDTSessionInviteCancel message.
const RMCReceiveReceipt = "recvreceipt"
RMCReceiveReceipt is the command for a RMReceiveReceipt value.
const RMCTransitiveMessage = "transitivemessage"
const RMCTransitiveMessageForward = "tmessageforward"
const RMCTransitiveMessageReply = "transitivemessagereply"
const RMCTransitiveReset = "transitivereset"
RMTransitiveReset ask proxy to forward reset message to another client.
const RMCTransitiveResetReply = "transitiveresetreply"
RMTransitiveResetReply ask proxy to forward reset message reply to another client.
const RMCUser = "user"
const RMCUserReply = "userreply"
const RMGCGroupUpdateAdmins = "groupupdateadmins"
const RMOCFullKX = "ofullkx"
const RMOCHalfKX = "ohalfkx"
const (
RMOHeaderVersion = 1
)
Following is the portion of the oob protocol which does travel over the wire.
Variables ¶
var ErrRMInvoicePayment = errors.New("invoice payment error on RM push")
ErrRMInvoicePayment is generated on servers when an RM push fails due to some payment check failure in the invoice.
Do not change this message as it's used in plain text across the C2S RPC interface.
var ErrUnableToGenerateInvoice = errors.New("unable to generate payment invoice")
ErrUnableToGenerateInvoice is generated on clients when they are unable to generate an invoice for a remote peer.
Do not change this message as it's used in plain text across the C2C RPC interface.
Functions ¶
func CalcPushCostMAtoms ¶ added in v0.2.3
func CalcPushCostMAtoms(minPushPayment, payRateMAtoms, payRateBytes, sizeBytes uint64) (int64, error)
CalcPushCostMAtoms calculates the cost to push a message of the given size using the given policy of min push payment, pay rate (in MAtoms) over the given number of pay rate bytes.
func CalcRTDTSessPushMAtoms ¶ added in v0.2.4
func CalcRTDTSessPushMAtoms(joinRate, payRateMAtoms, payRateMB uint64, sessMB, sessSize uint32) (int64, error)
CalcRTDTSessPushMAtoms calculates the amount to pay to send data in a RTDT session with the passed parameters.
func CalcRTDTSessPushMB ¶ added in v0.2.4
func CalcRTDTSessPushMB(joinRate, payRateMAtoms, payRateMB uint64, sessSize uint32, paidMAtoms int64) (uint32, error)
CalcRTDTSessPushMB calculates the number of MB paid to push data in an RTDT session with the passed parameters.
This is the inverse of CalcRTDTSessPushMAtoms.
func ComposeCompressedRM ¶
func ComposeCompressedRM(fromSigner MessageSigner, rm interface{}, zlibLevel int) ([]byte, error)
ComposeCompressedRM creates a blobified message that has a header and a payload that can then be encrypted and transmitted to the other side. The contents are zlib compressed with the specified level.
func ComposeCompressedRMWithHeader ¶ added in v0.2.3
func ComposeCompressedRMWithHeader(fromSigner MessageSigner, h RMHeader, rm interface{}, zlibLevel int) ([]byte, error)
ComposeCompressedRMWithHeader composes an RM with the specified payload and header.
Note: the caller must ensure that the header and rm payload have the correct command, otherwise decoding may fail.
func ComposeRM ¶
func ComposeRM(fromSigner MessageSigner, rm interface{}) ([]byte, error)
ComposeRM creates a blobified message that has a header and a payload that can then be encrypted and transmitted to the other side.
func ComposeRMO ¶
ComposeRMO creates a blobified oob message that has a header and a payload that can then be encrypted and transmitted to the other side.
func DecryptOOB ¶
func DecryptOOB(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (interface{}, error)
func EncryptRMO ¶
func EncryptRMO(x interface{}, theirKey *zkidentity.FixedSizeSntrupPublicKey, zlibLevel int) ([]byte, error)
EncryptRMO returns an encrypted blob from x. The returned blob is packed and prefixed with a sntrup ciphertext followed by an encrypted JSON objecti; or [sntrup ciphertext][encrypted JSON object].
func EstimateRoutedRMWireSize ¶ added in v0.1.3
EstimateRoutedRMWireSize estimates the final wire size of a compressed RM (with compression set to its lowest value, which effectively disables it).
func IsPostStatus ¶
IsPostStatus returns true when the map of attributes (possibly) corresponds to a post status update.
func MarshalOOBPublicIdentityInvite ¶
func MarshalOOBPublicIdentityInvite(pii *OOBPublicIdentityInvite) ([]byte, error)
MarshalOOBPublicIdentityInvite returns a JSON encoded OOBPublicIdentityInvite.
func MaxMsgSizeForVersion ¶ added in v0.1.10
func MaxMsgSizeForVersion(v MaxMsgSizeVersion) uint
MaxMsgSizeForVersion returns the max message size according to the given max message size version. It returns 0 for unknown versions.
func MaxPayloadSizeForVersion ¶ added in v0.1.10
func MaxPayloadSizeForVersion(v MaxMsgSizeVersion) uint
MaxPayloadSizeForVersion returns the (approximate) max payload size according to the given max message size version. It returns 0 for unknown versions.
It is approximate because due to encoding and compression, the actual payload may be slightly greater than this, but clients should not attempt to send more than this amount of data.
func NewFullRatchetKX ¶
func NewFullRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, them zkidentity.PublicIdentity, halfKX *ratchet.KeyExchange) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
NewFullRatchetKX creates a new full ratchet between two identities. It returns the completed full ratchet.
ourPrivKey should be the private key that corresponds to the local client's full identity.
func NewHalfRatchetKX ¶
func NewHalfRatchetKX(ourPrivKey *zkidentity.FixedSizeSntrupPrivateKey, them zkidentity.PublicIdentity) (*ratchet.Ratchet, *ratchet.KeyExchange, error)
NewHalfRatchetKX creates a new half ratchet between two identities. It returns the half ratchet and a random key exchange structure.
ourPrivKey should be the local client's private key from their full identity.
func ParseErrUnpaidSubscriptionRV ¶
ParseErrUnpaidSubscriptionRV attempts to parse a string as an ErrUnpaidSubscriptionRV. If this fails, it returns a nil error. If it succeeds, the return value is an instance of ErrUnpaidSubscriptionRV.
Types ¶
type Acknowledge ¶
Acknowledge is sent to acknowledge commands and Error is set if the command failed.
type AppointRTDTServer ¶ added in v0.2.4
type AppointRTDTServer struct {
// AppointCookie is the peer's appointment cookie, generated by the
// session owner/admin.
AppointCookie []byte `json:"appoint_cookie"`
}
AppointRTDTServer is the PRPC command sent by a client to enable it to join and (optionally) send data in an RTDT session.
type AppointRTDTServerReply ¶ added in v0.2.4
type AppointRTDTServerReply struct {
// JoinCookie is the opaque join cookie the client should use to join
// the RTDT server.
JoinCookie []byte `json:"join_cookie"`
// ServerAddress is the address (FQDN or IP and port) of the RTDT server
// the client should use to join.
ServerAddress string `json:"server_address"`
// ServerPubKey is the public key of the RTDT server. If nil, the server
// does not use client/server encryption (data is sent in plaintext).
ServerPubKey *zkidentity.FixedSizeSntrupPublicKey `json:"server_pubkey"`
}
AppointRTDTServerReply is the reply to a previous AppointRTDTServer command.
type CreateRTDTSession ¶ added in v0.2.4
type CreateRTDTSession struct {
// Size is the max number of concurrent users in the session. This
// determines the payment rates for the session.
Size uint32 `json:"size"`
}
CreateRTDTSession is a PRPC command to create a new RTDT session on brserver.
type CreateRTDTSessionReply ¶ added in v0.2.4
type CreateRTDTSessionReply struct {
// SessionCookie is opaque session data that identifies the session.
SessionCookie []byte `json:"session_cookie"`
}
CreateRTDTSessionReply is the PRPC reply to CreateRTDTSession.
type ErrUnpaidSubscriptionRV ¶
ErrUnpaidSubscriptionRV is an error returned while attempting to subscribe to an RV that wasn't previously paid.
func (ErrUnpaidSubscriptionRV) Error ¶
func (err ErrUnpaidSubscriptionRV) Error() string
func (ErrUnpaidSubscriptionRV) Is ¶
func (err ErrUnpaidSubscriptionRV) Is(other error) bool
type FileManifest ¶
type FileMetadata ¶
type FileMetadata struct {
Version uint64 `json:"version"`
Cost uint64 `json:"cost"`
Size uint64 `json:"size"`
Directory string `json:"directory"`
Filename string `json:"filename"`
Description string `json:"description"`
Hash string `json:"hash"`
Manifest []FileManifest `json:"manifest"` // len == number of chunks
Signature string `json:"signature"`
Attributes map[string]string `json:"attributes,omitempty"`
}
func (*FileMetadata) MetadataHash ¶
func (fm *FileMetadata) MetadataHash() [32]byte
MetadataHash calculates the hash of the metadata info. Note that the specific information that is hashed depends on the version of the metadata.
type GetInvoice ¶
type GetInvoice struct {
PaymentScheme string // LN, on-chain, whatever
Action GetInvoiceAction // push or subscribe
}
type GetInvoiceAction ¶
type GetInvoiceAction string
GetInvoiceAction is the action the client wants to perform and needs an invoice for.
const ( InvoiceActionPush GetInvoiceAction = "push" InvoiceActionSub GetInvoiceAction = "sub" InvoiceActionCreateRTSess GetInvoiceAction = "creatertsess" InvoiceActionGetRTCookie GetInvoiceAction = "getrtcookie" InvoiceActionPublishInRTSess GetInvoiceAction = "pubinrtsess" )
type GetInvoiceReply ¶
type GetInvoiceReply struct {
Invoice string // Depends on payment scheme
}
type GetRTDTAppointCookies ¶ added in v0.2.4
type GetRTDTAppointCookies struct {
// SessionCookie is the opaque session cookie created by the
// CreateRTDTSession PRPC.
SessionCookie []byte `json:"session_cookie"`
// OwnerSecret is random data from the session owner. This is used as
// part of the unique session id in the RTDT server.
//
// Using the same SessionCookie with different OwnerSecret values will
// put users in different RTDT sessions.
OwnerSecret zkidentity.ShortID `json:"owner_secret"`
// Peers is the list of peers for which an appointment cookie is
// requested.
Peers []RTDTAppointmentCookiePeer `json:"peers"`
// OldOwnerSecret is the prior owner secret for this session. When
// specified, the server generates a rotation cookie to be used to
// perform a live session id rotation.
OldOwnerSecret *zkidentity.ShortID `json:"old_owner_secret"`
}
GetRTDTAppointCookies is a PRPC command that an RTDT session owner or admin uses to get a list of appointment cookies from brserver for clients to use to join an RTDT session.
type GetRTDTAppointCookiesReply ¶ added in v0.2.4
type GetRTDTAppointCookiesReply struct {
// AppointCookies are the appointment cookies for the peer ids passed
// in the GetAppointCookies PRPC command.
AppointCookies [][]byte `json:"appoint_cookies"`
// RotateCookie is the rotate cookie created when rotating the
// appointment cookies.
RotateCookie []byte `json:"rotate_cookie"`
}
GetRTDTAppointCookiesReply is the set of appointment cookie replies from the server.
type InviteFunds ¶ added in v0.1.7
type MaxMsgSizeVersion ¶ added in v0.1.10
type MaxMsgSizeVersion uint
MaxMsgSizeVersion tracks defined versions of max msg size.
const ( // MaxMsgSizeV0 is the first version of the max size of a message. // This was determined as enough to contain a base64 encoded version of // 1MiB (1024*1024 bytes), along with the necessary overhead of // headers, encodings and frames needed by the encrypted routed // messages with some room to spare, when sending with compression // turned off. MaxMsgSizeV0 MaxMsgSizeVersion = 0 // MaxMsgSizeV1 is the second version of the max size of a message. // This was determined as enough to contain a base64 encoded version // of 10 MiB (10*1024*1024 bytes), along with the necessary overhead of // headers, encodings and frames needed by the encrypted routed mesasges // with some room to spare, when sending with compression turned off. MaxMsgSizeV1 MaxMsgSizeVersion = 1 )
type Message ¶
type Message struct {
Command string // discriminator
TimeStamp int64 // originator timestamp
Cleartext bool // If set Payload is in clear text, proxy use only
Tag uint32 // client generated tag, shall be unique
}
Message is the generic command that flows between a server and client and vice versa. Its purpose is to add a discriminator to simplify payload decoding. Additionally it has a tag that the recipient shall return unmodified when replying. The tag is originated by the sender and shall be unique provided an answer is expected. The receiver shall not interpret or use the tag in any way. The Cleartext flag indicates that the payload is in clear text. This flag should only be used for proxy commands (e.g. ratchet reset).
type MessageMode ¶
type MessageMode uint32
type MessageSigner ¶ added in v0.2.0
type MessageSigner func(message []byte) zkidentity.FixedSizeSignature
type MessageVerifier ¶ added in v0.2.0
type MessageVerifier func(msg []byte, sig *zkidentity.FixedSizeSignature) bool
type OOBPublicIdentityInvite ¶
type OOBPublicIdentityInvite struct {
Public zkidentity.PublicIdentity `json:"public"`
InitialRendezvous zkidentity.ShortID `json:"initialrendezvous"`
ResetRendezvous zkidentity.ShortID `json:"resetrendezvous"`
Funds *InviteFunds `json:"funds,omitempty"`
}
OOBPublicIdentityInvite is an unencrypted OOB command which contains all information to kick of an initial KX. This command is NOT part of the wire protocol. This is provided out-of-band. With this the other side can commence a KX by issuing a RMOCHalfKX command to the provided InitialRendezvous.
func CreateOOBPublicIdentityInvite ¶
func CreateOOBPublicIdentityInvite(pi zkidentity.PublicIdentity) (*OOBPublicIdentityInvite, error)
CreateOOBPublicIdentityInvite returns a OOBPublicIdentityInvite structure with a random initial and reset rendezvous.
func DecryptOOBPublicIdentityInvite ¶
func DecryptOOBPublicIdentityInvite(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (*OOBPublicIdentityInvite, error)
func UnmarshalOOBPublicIdentityInviteFile ¶
func UnmarshalOOBPublicIdentityInviteFile(filename string) (*OOBPublicIdentityInvite, error)
UnmarshalOOBPublicIdentityInviteFile returns an OOBPublicIdentityInvite from a file.
type Ping ¶
type Ping struct{}
Ping is a PRPC that is used to determine if the server is alive. This command must be acknowledged by the remote side.
type PostListItem ¶
type PostListItem struct {
ID zkidentity.ShortID `json:"id"`
Title string `json:"title"`
Timestamp int64 `json:"timestamp"`
}
type PostMetadata ¶
type PostMetadata struct {
Version uint64 `json:"version"`
Attributes map[string]string `json:"attributes,omitempty"`
}
func (*PostMetadata) Hash ¶
func (pm *PostMetadata) Hash() [32]byte
type PostMetadataStatus ¶
type PostMetadataStatus struct {
Version uint64 `json:"version"`
From string `json:"from"` // Who sent update
Link string `json:"link"` // Original post ID
Attributes map[string]string `json:"attributes,omitempty"`
}
func (*PostMetadataStatus) Hash ¶
func (pm *PostMetadataStatus) Hash() [32]byte
type PushRoutedMessage ¶
type RMFTGet ¶
type RMFTGet struct {
Directory string `json:"directory"` // Which directory **DEPRECATED
Filename string `json:"filename"` // Which file **DEPRECATED
Tag uint32 `json:"tag"` // Tag to copy in replies
FileID string `json:"file_id"` // Equals metadata hash
}
RMFTGet attempts to retrieve a file from another user
type RMFTGetChunk ¶
type RMFTGetChunk struct {
FileID string `json:"file_id"`
Hash []byte `json:"hash"` // Chunk to retrieve
Index int `json:"index"`
Tag uint32 `json:"tag"` // Tag to copy in replies
}
RMFTGetChunk attempts to retrieve a file chunk from another user.
type RMFTGetChunkReply ¶
type RMFTGetChunkReply struct {
FileID string `json:"file_id"`
Index int `json:"index"`
Chunk []byte `json:"chunk"` // Actual data, needs to be hashed to verify
Tag uint32 `json:"tag"`
Error *string `json:"error,omitempty"`
}
RMFTGetChunkReply chunked file get reply
type RMFTGetReply ¶
type RMFTGetReply struct {
Metadata FileMetadata `json:"metadata"`
Tag uint32 `json:"tag"`
Error *string `json:"error,omitempty"`
}
RMFTGetReply file metadata get reply
type RMFTList ¶
type RMFTList struct {
Directories []string `json:"directories"` // Which directories to obtain
Filter string `json:"filter,omitempty"` // Filter list by this regex
Tag uint32 `json:"tag"` // Tag to copy in replies
}
RMFTList asks other side for a list of files. Directories are constants that describe which directories it should access. Currently only "global" and "shared" are allowed.
type RMFTListReply ¶
type RMFTListReply struct {
Global []FileMetadata `json:"global,omitempty"`
Tag uint32
Error *string `json:"error,omitempty"`
}
type RMFTPayForChunk ¶
type RMFTSendFile ¶
type RMFTSendFile struct {
Metadata FileMetadata `json:"metadata"`
}
type RMFetchResource ¶ added in v0.1.8
type RMFetchResource struct {
Path []string `json:"path"`
Meta map[string]string `json:"meta"`
Tag ResourceTag `json:"tag"`
Data json.RawMessage `json:"data"`
Index uint32 `json:"index"`
Count uint32 `json:"count"`
}
type RMFetchResourceReply ¶ added in v0.1.8
type RMFetchResourceReply struct {
Tag ResourceTag `json:"tag"`
Status ResourceStatus `json:"status"`
Meta map[string]string `json:"meta"`
Data []byte `json:"data"`
Index uint32 `json:"index"`
Count uint32 `json:"count"`
}
type RMGetInvoice ¶
type RMGetPost ¶
type RMGetPost struct {
ID zkidentity.ShortID `json:"id"`
IncludeStatus bool `json:"include_status"`
}
type RMGroupInvite ¶
type RMGroupInvite struct {
ID zkidentity.ShortID `json:"id"` // group id
Name string `json:"name"` // requested group name
Token uint64 `json:"token"` // invite token
Description string `json:"description"` // group description
Expires int64 `json:"expires"` // unix time when this invite expires
Version uint8 `json:"version"` // version the GC is running on
}
RMGroupInvite invites a user to a group chat.
type RMGroupJoin ¶
type RMGroupJoin struct {
// XXX who sent this?
ID zkidentity.ShortID `json:"id"` // group id
Token uint64 `json:"token"` // invite token, implicitly identifies sender
Error string `json:"error"` // accept or deny Invite
}
RMGroupJoin instructs inviter that a user did or did not join the group.
type RMGroupKick ¶
type RMGroupKick struct {
Member [zkidentity.IdentitySize]byte `json:"member"` // kickee
Reason string `json:"reason"` // why member was kicked
Parted bool `json:"parted"` // kicked/parted
NewGroupList RMGroupList `json:"newgrouplist"` // new GroupList
}
RMGroupKick kicks a naughty member out of the group chat.
type RMGroupKill ¶
type RMGroupKill struct {
// XXX who sent this?
ID zkidentity.ShortID `json:"id"` // group id
Reason string `json:"reason"` // reason to disassemble group
}
RMGroupKill, sender is implicit to CRPC
type RMGroupList ¶
type RMGroupList struct {
ID zkidentity.ShortID `json:"id"` // group id
Name string `json:"name"`
Generation uint64 `json:"generation"` // incremented every time list changes
Timestamp int64 `json:"timestamp"` // unix time last generation changed
Version uint8 `json:"version"` // version of the rules for GC op
// Members is the list of GC participants. Members[0] is the "owner"
// of the GC and has power over admins.
Members []zkidentity.ShortID `json:"members"`
// ExtraAdmins are additional admins. Members[0] is still considered
// an admin in version 1 GCs.
ExtraAdmins []zkidentity.ShortID `json:"extra_admins"`
}
RMGroupList defines a Group Chat channel.
type RMGroupMessage ¶
type RMGroupMessage struct {
ID zkidentity.ShortID `json:"id"` // group name
Generation uint64 `json:"generation"` // Generation used
Message string `json:"message"` // Actual message
Mode MessageMode `json:"mode"` // 0 regular mode, 1 /me
}
RMGroupMessage is a message to a group.
type RMGroupPart ¶
type RMGroupPart struct {
// XXX who sent this?
ID zkidentity.ShortID `json:"id"` // group id
Reason string `json:"reason"` // reason to depart group
}
RMGroupPart is sent to tell the group chat that a user has departed.
type RMGroupUpdateAdmins ¶ added in v0.1.6
type RMGroupUpdateAdmins struct {
Reason string `json:"reason"`
NewGroupList RMGroupList `json:"newgrouplist"`
}
RMGroupUpdateAdmins updates the list of extra admins in the GC.
type RMGroupUpgradeVersion ¶ added in v0.1.6
type RMGroupUpgradeVersion struct {
NewGroupList RMGroupList `json:"newgrouplist"`
}
type RMHandshakeACK ¶ added in v0.1.8
type RMHandshakeACK struct{}
type RMHandshakeSYN ¶ added in v0.1.8
type RMHandshakeSYN struct{}
type RMHandshakeSYNACK ¶ added in v0.1.8
type RMHandshakeSYNACK struct{}
type RMHeader ¶
type RMHeader struct {
Version uint64 `json:"version"`
Timestamp int64 `json:"timestamp"`
Command string `json:"command"`
Tag uint32 `json:"tag"`
Signature zkidentity.FixedSizeSignature `json:"signature,omitempty"`
}
func DecomposeRM ¶
func DecomposeRM(msgVerifier MessageVerifier, mb []byte, maxDecompressSize uint) (*RMHeader, interface{}, error)
DecomposeRM decodes a message of up to maxDecompressSize bytes from mb.
type RMInvite ¶
type RMInvite struct {
Invitee zkidentity.PublicIdentity `json:"invitee"` // XXX why aren't we using Identity here?
}
RMInvite request an invite for third party.
type RMKXSearch ¶
type RMKXSearch struct {
Refs []RMKXSearchRef `json:"refs"`
}
RMKXSearch is sent when a user wishes to perform a transitive/recursive KX search for someone.
type RMKXSearchRef ¶
type RMKXSearchRef struct {
Type RMKXSearchRefType `json:"type"`
Ref string `json:"ref"`
}
RMKXSearchRef identifies a specific reference that is being used to search for a user.
type RMKXSearchRefType ¶
type RMKXSearchRefType string
RMKXSearchRefType identifies the type of a reference used in a kx search message.
const (
KXSRTPostAuthor RMKXSearchRefType = "postauthor"
)
type RMKXSearchReply ¶
type RMKXSearchReply struct {
TargetID zkidentity.ShortID `json:"target_id"`
IDs []zkidentity.ShortID `json:"ids"`
}
RMKXSearchReply is sent with a list of candidates the user might attempt to use to connect to target.
type RMKXSuggestion ¶
type RMKXSuggestion struct {
Target zkidentity.PublicIdentity
}
type RMListPosts ¶
type RMListPosts struct{}
type RMListPostsReply ¶
type RMListPostsReply struct {
Posts []PostListItem `json:"posts"`
}
type RMMediateIdentity ¶
type RMMediateIdentity struct {
Identity [zkidentity.IdentitySize]byte `json:"identity"`
}
RMMediateIdentity as target to send a RMInvite on the caller's behalf. This should kick of an autokx.
type RMOFullKX ¶
type RMOFullKX struct {
FullKX ratchet.KeyExchange `json:"fullkx"`
}
RMOFullKX
func DecryptOOBFullKXBlob ¶
func DecryptOOBFullKXBlob(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (*RMOFullKX, error)
DecryptOOBFullKXBlob decrypts a packed RMOFullKX blob.
type RMOHalfKX ¶
type RMOHalfKX struct {
Public zkidentity.PublicIdentity `json:"public"`
HalfKX ratchet.KeyExchange `json:"halfkx"`
InitialRendezvous ratchet.RVPoint `json:"initialrendezvous"`
ResetRendezvous ratchet.RVPoint `json:"resetrendezvous"`
}
RMOHalfKX is the command that flows after receiving an OOBPublicIdentityInvite.
func DecryptOOBHalfKXBlob ¶
func DecryptOOBHalfKXBlob(packed []byte, key *zkidentity.FixedSizeSntrupPrivateKey, maxDecompressSize uint) (*RMOHalfKX, error)
DecryptOOBHalfKXBlob decrypts a packed RMOHalfKX blob.
func NewHalfKX ¶
func NewHalfKX(us zkidentity.PublicIdentity, hkx *ratchet.KeyExchange) (*RMOHalfKX, error)
NewHalfKX creates a RMOHalfKX structure from a half ratchet.
us should be the public identity that is derived from the local client's full identity.
type RMOHeader ¶
type RMOHeader struct {
Version uint64 `json:"version"`
Timestamp int64 `json:"timestamp"`
Command string `json:"command"`
}
RMOHeader describes which command follows this structure.
type RMPostGetReply ¶
type RMPostStatus ¶
type RMPostStatus struct {
Link string `json:"link"` // Link to post
Attributes map[string]string `json:"attributes"`
}
RMPostStatusReply sets attributes such as status on a post. Attributes is a key value store that is used to describe the update attributes.
type RMPostStatusReply ¶
type RMPostStatusReply struct {
Error *string `json:"error,omitempty"`
}
type RMPostsSubscribe ¶
type RMPostsSubscribe struct {
// GetPost is an optional post to send to the client, assuming
// subscribing to the posts worked.
GetPost *zkidentity.ShortID `json:"get_post,omitempty"`
// IncludeStatus also sends the post status updates if GetPost != nil.
IncludeStatus bool `json:"include_status,omitempty"`
}
RMPostSubscribe subscribes to new posts from a user.
type RMPostsSubscribeReply ¶
type RMPostsSubscribeReply struct {
Error *string `json:"error,omitempty"`
}
type RMPostsUnsubscribe ¶
type RMPostsUnsubscribe struct{}
RMPostUnsubscribe unsubscribes to new posts from a user.
type RMPostsUnsubscribeReply ¶
type RMPostsUnsubscribeReply struct {
Error *string `json:"error,omitempty"`
}
type RMPrivateMessage ¶
type RMProfileUpdate ¶ added in v0.2.0
type RMProfileUpdate struct {
// Avatar is the user's avatar. If set to nil, the avatar is not
// updated. If set to an empty slice, the avatar is cleared.
Avatar []byte `json:"avatar"`
}
RMProfileUpdate is a message sent by a client when it has updated one of its profile fields.
type RMRTDTAdminCookies ¶ added in v0.2.4
type RMRTDTAdminCookies struct {
RV zkidentity.ShortID `json:"rv"`
SessionCookie []byte `json:"session_cookie"`
OwnerSecret *zkidentity.ShortID `json:"owner_secret"`
Members []RMRTDTAdminMember `json:"members"`
NextPeerID *RTDTPeerID `json:"next_peer_id"`
}
RMRTDTAdminCookies is a routed message sent from an RTDT session admin to other (new) admins to share the details of a (potentially new) session cookie, owner secret and appointment cookies.
type RMRTDTAdminMember ¶ added in v0.2.4
type RMRTDTAdminMember struct {
UID zkidentity.ShortID `json:"uid"`
PeerID RTDTPeerID `json:"peer_id"`
AppointCookie []byte `json:"appoint_cookie"`
AllowedAsPublisher bool `json:"allowed_as_publisher"`
}
RMRTDTAdminMember is one member of a session, with metadata required by session admins.
type RMRTDTDissolveSession ¶ added in v0.2.4
type RMRTDTDissolveSession struct {
RV zkidentity.ShortID `json:"rv"`
}
RMRTDTDissolveSession is a routed message sent from the RTDT session owner when they are dissolving the session.
type RMRTDTExitSession ¶ added in v0.2.4
type RMRTDTExitSession struct {
RV zkidentity.ShortID `json:"rv"`
}
RMRTDTExitSession is a routed message sent from a member that wishes to permanently leave an RTDT session.
type RMRTDTRemovedFromSession ¶ added in v0.2.4
type RMRTDTRemovedFromSession struct {
RV zkidentity.ShortID `json:"rv"`
Reason string `json:"reason"`
}
RMRTDTRemovedFromSession is a routed message sent from an RTDT session admin when a client was forcibly removed.
type RMRTDTRotateAppointCookie ¶ added in v0.2.4
type RMRTDTRotateAppointCookie struct {
RV zkidentity.ShortID `json:"rv"`
AppointCookie []byte `json:"appoint_cookie"`
}
RMRTDTRotateAppointCookie is a routed message sent from an RTDT session admin when the appointment cookie of the user was rotated to a new one.
type RMRTDTSession ¶ added in v0.2.4
type RMRTDTSession struct {
// Generation is increased on every change to the session.
Generation uint32 `json:"generation"`
// RV is the unique session identifier.
RV zkidentity.ShortID `json:"rv"`
// Size is the max number of concurrent users in the session.
Size uint32 `json:"size"`
// Description is a small description of the session.
Description string `json:"description"`
// Owner is the user ID of the owner of the session.
Owner zkidentity.ShortID `json:"owner"`
// Admins is a list of admins of the session.
Admins []zkidentity.ShortID `json:"admins"`
// Publishers is a list of users allowed to publish data in the
// session.
Publishers []RMRTDTSessionPublisher `json:"publishers"`
// IsInstant determines if this is an instant/ephemeral call.
IsInstant bool `json:"is_instant"`
}
RMRTDTSession is the routed message that updates a client about changes in an RTDT session. This comes from the owner/admin of the session.
func (*RMRTDTSession) AllAdmins ¶ added in v0.2.4
func (sess *RMRTDTSession) AllAdmins() []zkidentity.ShortID
AllAdmins returns the list of all admins (including owner) of the session.
func (*RMRTDTSession) IsOwnerOrAdmin ¶ added in v0.2.4
func (sess *RMRTDTSession) IsOwnerOrAdmin(id zkidentity.ShortID) bool
IsOwnerOrAdmin returns true if the given ID is the owner or an admin of the session.
type RMRTDTSessionInvite ¶ added in v0.2.4
type RMRTDTSessionInvite struct {
// RV is the session RV.
RV zkidentity.ShortID `json:"rv"`
// AppointCookie is generated by the server to the session owner/admin
// and shared with the target client.
AppointCookie []byte `json:"appoint_cookie"`
// Size is the max number of users in the session.
Size uint32 `json:"size"`
// Description is a brief description of the session.
Description string `json:"description"`
// AllowedAsPublisher flags whether the client will be allowed to send
// data in the session. When this is false, the client can only receive
// data from other publishers ("spectate").
AllowedAsPublisher bool `json:"allowed_as_publisher"`
// PeerID is the peer id the client should use when sending realtime
// data.
PeerID RTDTPeerID `json:"peer_id"`
// GC is filled if this session is to be associated with a particular
// GC.
GC *zkidentity.ShortID `json:"gc"`
// Tag identifies this invite.
Tag uint64 `json:"tag"`
// IsInstant determines if this is an instant/ephemeral call.
//
// An instant call is one that is not meant for long term tracking, but
// rather for online/quick/temporary/immediate interaction.
//
// Usually, instant calls are immediately joined upon
// creation/acceptance and are automatically deleted from clients after
// finalization.
IsInstant bool `json:"is_instant"`
}
RMRTDTSessionInvite is the routed message sent from the RTDT session/owner to a remote client to invite it to a session.
type RMRTDTSessionInviteAccept ¶ added in v0.2.4
type RMRTDTSessionInviteAccept struct {
// RV is the RV of the session.
RV zkidentity.ShortID `json:"rv"`
// Tag must match the tag in the invitation.
Tag uint64 `json:"tag"`
// PublisherKey should be set if the client will send data in the
// session.
PublisherKey *zkidentity.FixedSizeSymmetricKey `json:"publisher_key"`
}
RMRTDTSessionInviteAccept is the routed message of the invitee accepting the invitation to join an RTDTSession.
type RMRTDTSessionInviteCancel ¶ added in v0.2.4
type RMRTDTSessionInviteCancel struct {
// RV is the RV of the session.
RV zkidentity.ShortID `json:"rv"`
// Tag must match the tag in the invitation.
Tag uint64 `json:"tag"`
// PublisherKey should be set if the client will send data in the
// session.
PublisherKey *zkidentity.FixedSizeSymmetricKey `json:"publisher_key"`
}
RMRTDTSessionInviteA is the routed message of the invitee canceling the invitation to join an RTDTSession.
type RMRTDTSessionPublisher ¶ added in v0.2.4
type RMRTDTSessionPublisher struct {
// PublisherID is the user ID of the client.
PublisherID zkidentity.ShortID `json:"publisher_id"`
// PeerID is the realtime id of messages sent by the client.
PeerID RTDTPeerID `json:"peer_id"`
// PublisherKey is the key to decrypt messages from this peer.
PublisherKey zkidentity.FixedSizeSymmetricKey `json:"publisher_key"`
// Alias is the user's nick.
Alias string `json:"alias"`
}
RMRTDTSessionPublisher tracks information about a client that sends data in a RTDT session.
type RMReceiptDomain ¶ added in v0.1.10
type RMReceiptDomain string
RMReceiptDomain are the valid read receipt domains.
const ( ReceiptDomainPosts RMReceiptDomain = "posts" ReceiptDomainPostComments RMReceiptDomain = "postcomments" )
type RMReceiveReceipt ¶ added in v0.1.10
type RMReceiveReceipt struct {
// Domain is the type of receipt.
Domain RMReceiptDomain
// ID is the main ID of the receipt. Depends on the domain.
//
// post, postcomments : ID of the post.
ID *zkidentity.ShortID
// SubID is the secondary id of the receipt. Depends on the domain.
//
// posts: nil
// postcomments: ID of the comment.
SubID *zkidentity.ShortID
// ClientTime is the unix millisecond timestamp of when the client
// received.
ClientTime int64
}
RMReceiveReceipt is a receipt sent by a client when it has received an RM for something. The fields set and their interpretation depends on the domain.
type RMResourceBundle ¶ added in v0.2.4
type RMResourceBundle struct {
Resources map[string]RMFetchResourceReply
}
type RMTransitiveMessage ¶
type RMTransitiveMessage struct {
// For is the invitee identity and the corresponding public key that
// was used to encrypt the InviteBlob.
For zkidentity.ShortID `json:"for"`
// CipherText contains a sntrup4591761 encapsulated shared key that is
// used to encrypt the message. This ciphertext is decrypted by the
// intended final recipient.
CipherText zkidentity.FixedSizeSntrupCiphertext `json:"ciphertext,omitempty"`
// Message is an encrypted json encoded structure.
Message []byte `json:"message,omitempty"`
}
RMTransitiveMessage is a request to forward a message
type RMTransitiveMessageForward ¶
type RMTransitiveMessageForward struct {
// From is the sender identity. This is used as a hint to verify the
// signature and identity inside Message.
From zkidentity.ShortID `json:"from"`
// CipherText contains a sntrup4591761 encapsulated shared key that is
// used to encrypt the InviteBlob.
CipherText zkidentity.FixedSizeSntrupCiphertext `json:"ciphertext"`
// Message is an encrypted json encoded structure.
Message []byte `json:"message"`
}
RMTransitiveMessageForward forwards a transitive message to a user.
type RMTransitiveMessageReply ¶
type RMTransitiveMessageReply struct {
// For is the intended recipient that needs Message routed.
For zkidentity.ShortID `json:"for"`
// Error is set if the other side encountered an error.
Error *string `json:"error,omitempty"`
}
RMTransitiveMessageReply is a reply to a transitive message.
type RMTransitiveReset ¶
type RMTransitiveReset struct {
HalfKX ratchet.KeyExchange `json:"halfkx"` // Half ratchet
}
type RMTransitiveResetReply ¶
type RMTransitiveResetReply struct {
FullKX ratchet.KeyExchange `json:"fullkx"` // Full ratchet
}
type RMUser ¶
type RMUser struct{}
RMUser retrieves user attributes such as status, profile etc. Attributes is a key value store that is used to describe the user attributes.
type RMUserReply ¶
type RTDTAppointCookie ¶ added in v0.2.4
type RTDTAppointCookie struct {
// ServerSecret is the random server secret data.
ServerSecret zkidentity.ShortID
// OwnerSecret is random data generated by the owner. This is used as
// part of the session identifier within the RTDT server.
OwnerSecret zkidentity.ShortID
// Size is the size of the session.
Size uint32
// PeerID is the peer ID that should be used by the client.
PeerID RTDTPeerID
// AllowedAsPublisher is true if this peer is allowed to send data in
// the session.
AllowedAsPublisher bool
// IsAdmin is true if this peer is allowed to admin the live RTDT
// session.
IsAdmin bool
}
RTDTAppointCookie is shared by the RTDT session owner with a client to allow the client to join as a peer in the same session in the RTDT server.
func (*RTDTAppointCookie) Decrypt ¶ added in v0.2.4
func (ac *RTDTAppointCookie) Decrypt(in []byte, key *zkidentity.FixedSizeSymmetricKey, extraKeys []*zkidentity.FixedSizeSymmetricKey) error
Decrypt decrypts and authenticates the given data as an appointment cookie.
func (*RTDTAppointCookie) Encrypt ¶ added in v0.2.4
func (ac *RTDTAppointCookie) Encrypt(out []byte, key *zkidentity.FixedSizeSymmetricKey) []byte
Encrypt encrypts the appontment cookie using the specified key.
type RTDTAppointmentCookiePeer ¶ added in v0.2.4
type RTDTAppointmentCookiePeer struct {
// ID is the RTDT peer id.
ID RTDTPeerID `json:"id"`
// AllowedAsPublisher is true if the peer is allowed as publisher in
// the session.
AllowedAsPublisher bool `json:"allowed_as_publisher"`
// IsAdmin is true if the passed peer id is allowed as admin of the
// session.
IsAdmin bool `json:"is_admin"`
}
RTDTAppointmentCookiePeer is one peer for which an appointment cookie is requested.
type RTDTDataPacket ¶ added in v0.2.4
type RTDTDataPacket struct {
// Stream is the identifier of the logical media stream related to this
// data.
Stream RTDTStreamType
// Timestamp is a monotonically increasing timestamp of the media.
Timestamp uint32
// Data is the actual data.
Data []byte
// contains filtered or unexported fields
}
RTDTDataPacket is the end-to-end data sent between clients through an RTDT relay server.
func (*RTDTDataPacket) AppendEncrypted ¶ added in v0.2.4
func (p *RTDTDataPacket) AppendEncrypted(pkt *RTDTFramedPacket, out []byte, encryptionKey *zkidentity.FixedSizeSymmetricKey, sigKey *zkidentity.FixedSizeEd25519PrivateKey) []byte
AppendEncrypted appends a (possibly signed and encrypted) framed version of the data packet into out.
func (*RTDTDataPacket) AppendFramed ¶ added in v0.2.4
func (p *RTDTDataPacket) AppendFramed(pkt *RTDTFramedPacket, out []byte) []byte
AppendFramed appends a framed version of this packet to out.
NOTE: this appends the raw contents of the data packet directily, without signing or performing encryption. For those, see AppendEncrypted.
func (*RTDTDataPacket) Decrypt ¶ added in v0.2.4
func (p *RTDTDataPacket) Decrypt(source RTDTFramedPacket, encryptionKey *zkidentity.FixedSizeSymmetricKey, sigKey *zkidentity.FixedSizeEd25519PublicKey) error
Decrypt decrypts and deserializes the data inside the framed packet into this data packet.
If the encryption key is provided, the framed data is assumed to be encrypted and is thus authenticated and decrypted.
If the signature key is provided and the source packet has a signature, then the signature is also validated.
type RTDTFramedPacket ¶ added in v0.2.4
type RTDTFramedPacket struct {
// Target is the peer id of the receiving client in the channel. When
// sending, this will equal Source to route a data packet to every
// member of the session. Otherwise, this will be processed as an
// internal server command.
Target RTDTPeerID
// Source is the peer id of the sending client. When receiving, this
// will be zero for replies to server commands.
Source RTDTPeerID
// Sequence is used to drop old packets.
Sequence uint32
// Data is the framed packet data. This may be (possibly E2E encrypted)
// RTDTDataPacket or a serialized server command.
Data []byte
}
RTDTFramedPacket is an RTDT-framed (possibly end-to-end encrypted) packet, relayed between an RTDT server and client.
func (*RTDTFramedPacket) FromBytes ¶ added in v0.2.4
func (p *RTDTFramedPacket) FromBytes(b []byte) error
FromBytes decodes the byte slice into this framed packet.
func (*RTDTFramedPacket) ServerCmd ¶ added in v0.2.4
func (p *RTDTFramedPacket) ServerCmd() (RTDTServerCmdType, []byte)
ServerCmd decodes the packet as a server command and payload.
type RTDTJoinCookie ¶ added in v0.2.4
type RTDTJoinCookie struct {
// ServerSecret is the random server secret data.
ServerSecret zkidentity.ShortID
// OwnerSecret is random data generated by the owner. This is used as
// part of the session identifier within the RTDT server.
OwnerSecret zkidentity.ShortID
// Size is the size of the session.
Size uint32
// PeerID is the peer ID that should be used by the client.
PeerID RTDTPeerID
// EndTimestamp determines when this join cookie expires.
EndTimestamp int64 `json:"end_timestamp"`
// PublishAllowance is the total number of bytes that this user may send
// using this join cookie.
PublishAllowance uint64 `json:"publish_allowance"`
// PaymentTag is a unique payment identifier for this join cookie.
PaymentTag uint64 `json:"payment_tag"`
// IsAdmin is true if this client is allowed as an admin.
IsAdmin bool `json:"is_admin"`
}
RTDTJoinCookie is sent by the client to the RTDT server to uniquely identify the session it is joining and to extend its publish allowance.
func (*RTDTJoinCookie) Decrypt ¶ added in v0.2.4
func (jc *RTDTJoinCookie) Decrypt(in []byte, key *zkidentity.FixedSizeSymmetricKey, extraKeys []*zkidentity.FixedSizeSymmetricKey) error
Decrypt decrypts and authenticates the given data as a join cookie.
func (*RTDTJoinCookie) Encrypt ¶ added in v0.2.4
func (jc *RTDTJoinCookie) Encrypt(out []byte, key *zkidentity.FixedSizeSymmetricKey) []byte
Encrypt encrypts the join cookie with the specified key.
type RTDTPeerID ¶ added in v0.2.4
type RTDTPeerID uint32
RTDTPeerID is a peer identifier inside RTDT framed messages.
func (RTDTPeerID) Next ¶ added in v0.2.4
func (id RTDTPeerID) Next() RTDTPeerID
Next returns the next valid peer id, given id as a starting point.
func (RTDTPeerID) String ¶ added in v0.2.4
func (id RTDTPeerID) String() string
type RTDTPingCmd ¶ added in v0.2.4
type RTDTPingCmd struct {
// Data is opaque data sent by the sender.
Data []byte
}
RTDTPingCmd is the command to ping the server.
func (*RTDTPingCmd) AppendFramed ¶ added in v0.2.4
func (c *RTDTPingCmd) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTPingCmd) FromBytes ¶ added in v0.2.4
func (c *RTDTPingCmd) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTPongCmd ¶ added in v0.2.4
type RTDTPongCmd struct {
// Data is opaque data, originally sent by the sender of the
// corresponding Ping.
Data []byte
}
RTDTPongCmd is the reply to a ping command.
func (*RTDTPongCmd) AppendFramed ¶ added in v0.2.4
func (c *RTDTPongCmd) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTPongCmd) FromBytes ¶ added in v0.2.4
func (c *RTDTPongCmd) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTRotateCookie ¶ added in v0.2.4
type RTDTRotateCookie struct {
// ServerSecret is the random server secret data.
ServerSecret zkidentity.ShortID `json:"server_secret"`
// OldOwnerSecret is the previous OwnerSecret value.
OldOwnerSecret zkidentity.ShortID `json:"old_owner_secret"`
// NewOwnerSecret is the new OwnerSecret value.
NewOwnerSecret zkidentity.ShortID `json:"new_owner_secret"`
// Size is the size of the session.
Size uint32 `json:"size"`
// Timestamp is the unix timestamp in seconds of when this cookie was
// generated.
Timestamp int64 `json:"timestamp"`
// PaymentTag is a unique identifier of the cookie.
PaymentTag uint64 `json:"payment_tag"`
}
RTDTRotateCookie is the cookie used when an admin wants to rotate the secrets in a live session.
func (*RTDTRotateCookie) Decrypt ¶ added in v0.2.4
func (rc *RTDTRotateCookie) Decrypt(in []byte, key *zkidentity.FixedSizeSymmetricKey, extraKeys []*zkidentity.FixedSizeSymmetricKey) error
Decrypt decrypts the cookie from in.
func (*RTDTRotateCookie) Encrypt ¶ added in v0.2.4
func (rc *RTDTRotateCookie) Encrypt(out []byte, key *zkidentity.FixedSizeSymmetricKey) []byte
Encrypt encrypts the cookie in out.
type RTDTServerCmdJoinSession ¶ added in v0.2.4
type RTDTServerCmdJoinSession struct {
// JoinCookie is an opaque cookie generated from brserver and sent to
// the RTDT server.
JoinCookie []byte
}
RTDTServerCmdJoinSession is the command to join a session in the server.
func (*RTDTServerCmdJoinSession) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdJoinSession) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdJoinSession) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdJoinSession) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdJoinSessionReply ¶ added in v0.2.4
type RTDTServerCmdJoinSessionReply struct {
// ErrCode is the error code for processing this message.
//
// Note: the error code is only set when the server is running with
// a debug flag set. When that flag is not set, this field will be empty
// even when the session binding failed.
ErrCode uint64
}
RTDTServerCmdJoinSessionReply is the reply sent to a join session command.
func (*RTDTServerCmdJoinSessionReply) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdJoinSessionReply) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdJoinSessionReply) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdJoinSessionReply) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdKickPeer ¶ added in v0.2.4
type RTDTServerCmdKickPeer struct {
KickTarget RTDTPeerID
BanDurationSeconds uint32
}
RTDTServerCmdKickPeer is a RTDT server command to kick a peer from a session.
Can only be issued by admins.
func (*RTDTServerCmdKickPeer) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdKickPeer) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdKickPeer) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdKickPeer) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdKickPeerReply ¶ added in v0.2.4
type RTDTServerCmdKickPeerReply struct {
// KickTarget is the original target of the kick request.
KickTarget RTDTPeerID
// ErrCode is the error code for processing this message.
//
// Note: the error code is only set when the server is running with
// a debug flag set. When that flag is not set, this field will be empty
// even when the command failed.
ErrCode uint64
}
RTDTServerCmdKickPeerReply is the reply to a kick peer command.
func (*RTDTServerCmdKickPeerReply) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdKickPeerReply) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdKickPeerReply) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdKickPeerReply) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdLeaveSession ¶ added in v0.2.4
type RTDTServerCmdLeaveSession struct{}
RTDTServerCmdLeaveSession is a RTDT server command to leave a previously joined session.
func (*RTDTServerCmdLeaveSession) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdLeaveSession) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
type RTDTServerCmdLeaveSessionReply ¶ added in v0.2.4
type RTDTServerCmdLeaveSessionReply struct{}
RTDTServerCmdLeaveSessionReply is the reply to the previously sent leave session server command.
func (*RTDTServerCmdLeaveSessionReply) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdLeaveSessionReply) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
type RTDTServerCmdMembersBitmap ¶ added in v0.2.4
type RTDTServerCmdMembersBitmap struct {
// Bitmap is a serialization of a roaring bitmap of peer IDs.
Bitmap []byte
}
RTDTServerCmdMembersBitmap is a command from the server that lists the current member IDs bound to a session.
func (*RTDTServerCmdMembersBitmap) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdMembersBitmap) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdMembersBitmap) DecodeBitmap ¶ added in v0.2.4
func (c *RTDTServerCmdMembersBitmap) DecodeBitmap(bmp *roaring.Bitmap) error
DecodeBitmap decodes the bitmap data into a roaring bitmap object.
func (*RTDTServerCmdMembersBitmap) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdMembersBitmap) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdRotateSessionCookies ¶ added in v0.2.4
type RTDTServerCmdRotateSessionCookies struct {
RotateCookie []byte
}
RTDTServerCmdRotateSessionCookies rotates the session ID of a given session with every member. This has the side effect of banning anyone not in possession of new appointment cookies.
func (*RTDTServerCmdRotateSessionCookies) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdRotateSessionCookies) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdRotateSessionCookies) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdRotateSessionCookies) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdRotateSessionCookiesReply ¶ added in v0.2.4
type RTDTServerCmdRotateSessionCookiesReply struct {
ErrCode uint64
}
RTDTServerCmdRotateSessionCookiesReply is the reply to a rotate session cookies command.
func (*RTDTServerCmdRotateSessionCookiesReply) AppendFramed ¶ added in v0.2.4
func (c *RTDTServerCmdRotateSessionCookiesReply) AppendFramed(pkt *RTDTFramedPacket, b []byte) []byte
AppendFramed appends a framed version of this command to b.
func (*RTDTServerCmdRotateSessionCookiesReply) FromBytes ¶ added in v0.2.4
func (c *RTDTServerCmdRotateSessionCookiesReply) FromBytes(b []byte) error
FromBytes decodes this command from a byte slice.
type RTDTServerCmdType ¶ added in v0.2.4
type RTDTServerCmdType uint8
RTDTServerCmdType defines the known server commands.
const ( RTDTServerCmdTypePing RTDTServerCmdType = 0x01 RTDTServerCmdTypePong RTDTServerCmdType = 0x02 RTDTServerCmdTypeJoinSession RTDTServerCmdType = 0x03 RTDTServerCmdTypeJoinSessionReply RTDTServerCmdType = 0x04 RTDTServerCmdTypeLeaveSession RTDTServerCmdType = 0x05 RTDTServerCmdTypeLeaveSessionReply RTDTServerCmdType = 0x06 RTDTServerCmdTypeKickPeer RTDTServerCmdType = 0x07 RTDTServerCmdTypeKickPeerReply RTDTServerCmdType = 0x08 RTDTServerCmdTypeMembersBitmap RTDTServerCmdType = 0x09 RTDTServerCmdTypeRotateCookies RTDTServerCmdType = 0x0a RTDTServerCmdTypeRotateCookiesReply RTDTServerCmdType = 0x0b )
type RTDTSessionCookie ¶ added in v0.2.4
type RTDTSessionCookie struct {
// ServerSecret is random server data. This is used as part of the full
// session id.
ServerSecret zkidentity.ShortID
// Size is the size of the RTDT session (max number of concurrent
// peers).
Size uint32
}
RTDTSessionCookie is sent by a session owner or admin to manage an RTDT session.
func (*RTDTSessionCookie) Decrypt ¶ added in v0.2.4
func (sc *RTDTSessionCookie) Decrypt(in []byte, key *zkidentity.FixedSizeSymmetricKey, extraKeys []*zkidentity.FixedSizeSymmetricKey) error
Decrypt and authenticate the input stream as a session cookie using the specified key.
func (*RTDTSessionCookie) Encrypt ¶ added in v0.2.4
func (sc *RTDTSessionCookie) Encrypt(out []byte, key *zkidentity.FixedSizeSymmetricKey) []byte
Encrypt encrypts the session cookie using the specified key.
type RTDTStreamType ¶ added in v0.2.4
type RTDTStreamType uint8
RTDTStreamType identifies streams of data from a peer within an RTDT session.
const ( // RTDTStreamRandom is a stream of random data. This is used for // testing. RTDTStreamRandom RTDTStreamType = 0 // RTDTStreamSpeech is the default speech stream. This stream consists // of Opus-encoded packets, sent in a 20ms interval. RTDTStreamSpeech RTDTStreamType = 1 // RTDTStreamChat is the ephemeral chat stream. This stream consists of // UTF-8 encoded text messages. RTDTStreamChat RTDTStreamType = 2 )
type ResourceStatus ¶ added in v0.1.8
type ResourceStatus uint16
func (ResourceStatus) String ¶ added in v0.1.8
func (rs ResourceStatus) String() string
type ResourceTag ¶ added in v0.1.8
type ResourceTag uint64
func (*ResourceTag) FromString ¶ added in v0.1.8
func (tag *ResourceTag) FromString(s string) error
func (ResourceTag) MarshalJSON ¶ added in v0.1.8
func (tag ResourceTag) MarshalJSON() ([]byte, error)
MarshalJSON marshals the id into a json string.
func (ResourceTag) String ¶ added in v0.1.8
func (tag ResourceTag) String() string
func (*ResourceTag) UnmarshalJSON ¶ added in v0.1.8
func (tag *ResourceTag) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the json representation of a ShortID.
type RouteMessage ¶
RouteMessage is a hack
type RouteMessageReply ¶
type SeederClientAPI ¶ added in v0.2.4
type SeederClientAPI struct {
ServerGroups []SeederServerGroup `json:"serverGroups"`
}
SeederClientAPI is the response of a query from the seeder server to an end-user client (brclient).
type SeederCommandStatus ¶ added in v0.2.4
type SeederCommandStatus struct {
LastUpdated int64 `json:"lastUpdated"`
Database SeederCommandStatusDB `json:"db"`
Node SeederCommandStatusNode `json:"node"`
}
SeederCommandStatus is sent by brserver to brseeder.
type SeederCommandStatusDB ¶ added in v0.2.4
type SeederCommandStatusNode ¶ added in v0.2.4
type SeederCommandStatusReply ¶ added in v0.2.4
type SeederCommandStatusReply struct {
Master bool `json:"db_master"`
}
CommandStatusReply is the response from brseeder to brserver.
type SeederServerGroup ¶ added in v0.2.4
type ServerProperty ¶
type ServerProperty struct {
Key string // name of property
Value string // value of property
Required bool // if true client must handle this entry
}
func SupportedServerProperties ¶
func SupportedServerProperties() []ServerProperty
type SubscribeRoutedMessages ¶
type SuggestedClientVersion ¶ added in v0.2.4
type SuggestedClientVersion struct {
// Client is the client identifier ("brclient", "bruig", etc).
Client string `json:"client"`
// Version is the suggested client version (semver compatible).
Version string `json:"version"`
}
SuggestedClientVersion is a suggested client version sent by the server.
func SplitSuggestedClientVersions ¶ added in v0.2.4
func SplitSuggestedClientVersions(s string) []SuggestedClientVersion
SplitSuggestedClientVersions splits the given string into a list of suggested client versions.
type TxHash ¶ added in v0.1.7
func (*TxHash) FromString ¶ added in v0.1.7
FromString decodes s into a TxHash. s must contain an hex-encoded ID of the correct length.
func (TxHash) MarshalJSON ¶ added in v0.1.7
MarshalJSON marshals the id into a json string.
func (*TxHash) UnmarshalJSON ¶ added in v0.1.7
UnmarshalJSON unmarshals the json representation of a ShortID.
type Welcome ¶
type Welcome struct {
Version int // protocol version
ServerTime int64 // server timestamp
// Client shall ensure it is compatible with the server requirements
Properties []ServerProperty // server properties
}
Welcome is written immediately following a key exchange. This command purpose is to detect if the key exchange completed on the client side. If the key exchange failed the server will simply disconnect.