constants

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: LGPL-2.1 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRPCPort            string = "9525"
	DefaultWebSocketAddress   string = "127.0.0.1:8088"
	DefaultRestAddress        string = ":9531"
	DefaultDataDir            string = "./data/store"
	DefaultMLBlockchainAPIUrl string = ":9520"
	DefaultNetwork            string = "mainnet"
)
View Source
const (
	RelayNodeType     uint = 0
	ValidatorNodeType uint = 1
)
View Source
const (
	ErrorUnauthorized = "4001"
	ErrorBadRequest   = "4000"
	ErrorForbidden    = "4003"
)
View Source
const (
	UnprocessedClientPayloadStore DataStore = "unprocessed-client-payload-store"
	ValidMessageStore             DataStore = "valid-messages"
	UnsentMessageStore                      = "unsent-messages"
	SentMessageStore                        = "sent-messages"
	NewTopicSubscriptionStore               = "new-topic-subscription"
	TopicSubscriptionStore                  = "top-subscriptions"
	TopicSubscriptionCountStore             = "topic-subscription-count"
	DeliveryProofStore                      = "delivery-proof-store"
	UnconfirmedDeliveryProofStore           = "unconfirmed-delivery-proof-store"
	DeliveryProofBlockStateStore            = "delivery-proof-block-state-store"
	SubscriptionBlockStateStore             = "subscription-block-state-store"
	DeliveryProofBlockStore                 = "dp-block-store"
	SubscriptionBlockStore                  = "sub-block-store"
	ConnectedSubscribersMap                 = "connected-subscribers-map"
)
View Source
const (
	ConfigKey                       string = "Config"
	BroadcastAuthorizationEventChId string = "BroadcastAuthorizationEventChannel"
	BroadcastTopicEventChId                = "BroadcastTopicEventChannel"
	BroadcastSubnetEventChId               = "BroadcastSubnetEventChannel"
	// IncomingAuthorizationEventChId         = "IncomingAuthorizationEventChannel"
	IncomingTopicEventChId = "IncomingTopicEventChannel"

	OutgoingMessageChId     = "OutgoingMessageChannel"
	OutgoingMessageDP2PChId = "OutgoingMessageDP2PChannel"
	IncomingMessageChId     = "IncomingMessageChannel"

	PublishMessageChId              = "PublishMessageChannel"
	SubscribeChId                   = "SubscribeChannel"
	SubscriptionDP2PChId            = "SubscriptionDP2PChannel"
	ClientHandShackChId             = "ClientHandshakeChannel"
	OutgoingDeliveryProof_BlockChId = "OutgoingDeliveryProofBlockChannel"
	OutgoingDeliveryProofChId       = "OutgoinDeliveryProofChannel"
	PubSubBlockChId                 = "PubSubBlockChannel"
	PubsubDeliverProofChId          = "PubsubProofChannel"
	PublishedSubChId                = "PublishedSubChannel"
	SQLDB                           = "sqldb"
)

Channel Ids within main context

View Source
const (
	CurrentDeliveryProofBlockStateKey string = "/df-block/current-state"
	CurrentSubscriptionBlockStateKey  string = "/sub-block/current-state"
)

State store key

View Source
const MaxBlockSize = 1000
View Source
const SignatureMessageString string = `{"action":"%s","network":"%s","identifier":"%s","hash":"%s"}`
View Source
const (
	VALID_HANDSHAKE_SECONDS = 15 // time interval within which to accept a handshake
)

Variables

View Source
var HomeTemplate = template.Must(template.New("").Parse(`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>  
window.addEventListener("load", function(evt) {
    var output = document.getElementById("output");
    var input = document.getElementById("input");
    var ws;
    var print = function(message) {
        var d = document.createElement("div");
        d.textContent = message;
        output.appendChild(d);
        output.scroll(0, output.scrollHeight);
    };
    document.getElementById("open").onclick = function(evt) {
        if (ws) {
            return false;
        }
        ws = new WebSocket("{{.}}");
        ws.onopen = function(evt) {
            print("OPEN");
        }
        ws.onclose = function(evt) {
            print("CLOSE");
            ws = null;
        }
        ws.onmessage = function(evt) {
            print("RESPONSE: " + evt.data);
        }
        ws.onerror = function(evt) {
            print("ERROR: " + evt.data);
        }
        return false;
    };
    document.getElementById("send").onclick = function(evt) {
        if (!ws) {
            return false;
        }
        print("SEND: " + input.value);
        ws.send(input.value);
        return false;
    };
    document.getElementById("close").onclick = function(evt) {
        if (!ws) {
            return false;
        }
        ws.close();
        return false;
    };
});
</script>
</head>
<body>
<table>
<tr><td valign="top" width="50%">
<p>Click "Open" to create a connection to the server, 
"Send" to send a message to the server and "Close" to close the connection. 
You can change the message and send multiple times.
<p>
<form>
<button id="open">Open</button>
<button id="close">Close</button>
<p><input id="input" type="text" value="Hello world!">
<button id="send">Send</button>
</form>
</td><td valign="top" width="50%">
<div id="output" style="max-height: 70vh;overflow-y: scroll;"></div>
</td></tr></table>
</body>
</html>
`))

Functions

This section is empty.

Types

type AuthorizationPrivilege

type AuthorizationPrivilege uint8
const (
	ReadPriviledge  AuthorizationPrivilege = 0
	WritePriviledge AuthorizationPrivilege = 1
	AdminPriviledge AuthorizationPrivilege = 2
)

type DataStore

type DataStore string

type EventPayloadType

type EventPayloadType string
const (
	AuthorizationPayloadType EventPayloadType = "authorization"
	TopicPayloadType         EventPayloadType = "topic"
	SubscriptionPayloadType  EventPayloadType = "subscription"
	MessagePayloadType       EventPayloadType = "message"
	SubnetPayloadType        EventPayloadType = "sub_network"
	WalletPayloadType        EventPayloadType = "wallet"
)

type EventType

type EventType uint16
const (
	AuthorizationEvent   EventType = 100
	UnauthorizationEvent EventType = 101
)

Authrization

const (
	DeleteTopicEvent       EventType = 1000
	CreateTopicEvent       EventType = 1001 // m.room.create
	PrivacySetEvent        EventType = 1002
	BanMemberEvent         EventType = 1003
	UnbanMemberEvent       EventType = 1004
	ContractSetEvent       EventType = 1005
	UpdateNameEvent        EventType = 1006 //  m.room.name
	UpdateDescriptionEvent EventType = 1007 //  m.room.topic
	UpdateAvatarEvent      EventType = 1008 //  m.room.avatar
	PinMessageEvent        EventType = 1008 //  m.room.avatar
	UpdateTopicEvent       EventType = 1009
	UpgradeSubscriberEvent EventType = 1010
)

Administrative Topic Actions

const (
	LeaveEvent          EventType = 1100
	SubscribeTopicEvent EventType = 1101
	RequestedEvent      EventType = 1102
	ApprovedEvent       EventType = 1103
	InvitedEvent        EventType = 1104
)

Member Topic Actions

const (
	DeleteMessageEvent EventType = 1200 //m.room.encrypted
	SendMessageEvent   EventType = 1201 // m.room.message

)

Message Actions

const (
	DeleteSubnetEvent EventType = 1300
	CreateSubnetEvent EventType = 1301 // m.room.create
	// PrivacySetEvent        EventType = 1002
	// BanMemberEvent         EventType = 1003
	// UnbanMemberEvent       EventType = 1004
	// ContractSetEvent       EventType = 1005
	// UpdateNameEvent        EventType = 1006 //  m.room.name
	// UpdateDescriptionEvent EventType = 1007 //  m.room.topic
	// UpdateAvatarEvent      EventType = 1008 //  m.room.avatar
	// PinMessageEvent        EventType = 1008 //  m.room.avatar
	UpdateSubnetEvent EventType = 1309
)

Administrative Subnet Actions

const (
	DeleteWalletEvent EventType = 1400
	CreateWalletEvent EventType = 1401 // m.room.create

	UpdateWalletEvent EventType = 1409
)

Administrative Wallet Actions

type Protocol

type Protocol string
const (
	WS   Protocol = "ws"
	MQTT Protocol = "mqtt"
	RPC  Protocol = "rpc"
)

type SubnetCategory

type SubnetCategory int16
const (
	CategoryGeneral       SubnetCategory = 1
	CategoryMobility      SubnetCategory = 2
	CategoryEnergy        SubnetCategory = 3
	CategoryEnvironmental SubnetCategory = 4
	CategoryHealthcare    SubnetCategory = 5
	CategorySmartCity     SubnetCategory = 6
	CategorySmartHome     SubnetCategory = 7
	CategoryGeoLocation   SubnetCategory = 8
	CategoryP2PMessaging  SubnetCategory = 9
	CategorySharedCompute SubnetCategory = 10
	CategoryFileSharing   SubnetCategory = 11
)

type SubscriberPrivilege

type SubscriberPrivilege uint8
const (
	MemberSubPriviledge SubscriberPrivilege = 0
	AdminSubPriviledge  SubscriberPrivilege = 1
)

type SubscriptionStatuses

type SubscriptionStatuses int16
const (
	UnsubscribedSubscriptionStatus SubscriptionStatuses = 0
	PendingSubscriptionStatus      SubscriptionStatuses = 1
	SubscribedSubscriptionStatus   SubscriptionStatuses = 2
	// ApprovedSubscriptionStatus      SubscriptionStatuses = "approved"
	BannedSubscriptionStatus SubscriptionStatuses = 3
)

Jump to

Keyboard shortcuts

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