constants

package
v1.3.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

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

Channel Ids within main context

View Source
const (
	DefaultRPCPort            string = "9525"
	DefaultWebSocketAddress   string = "127.0.0.1:8088"
	DefaultRestAddress        string = ":9531"
	DefaultDataDir            string = "./data"
	DefaultMLBlockchainAPIUrl string = ":9520"
	DefaultQuickHost          string = "127.0.0.1:9533"
	DefaultProtocolVersion    string = "/mlayer/1.0.0"
)
View Source
const (
	ErrorUnauthorized = "4001"
	ErrorBadRequest   = "4000"
	ErrorForbidden    = "4003"
)
View Source
const (
	CurrentDeliveryProofBlockStateKey string = "/df-block/current-state"
	CurrentSubscriptionBlockStateKey  string = "/sub-block/current-state"
)

State store key

View Source
const (
	// UnprocessedClientPayloadStore DataStore = "unprocessed-client-payload-store"
	// ValidMessageStore             DataStore = "valid-messages"
	// UnsentMessageStore                      = "unsent-messages"
	// SentMessageStore                        = "sent-messages"
	NewTopicSubscriptionStore     DataStore = "new-topic-subscription"
	TopicSubscriptionStore        DataStore = "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       DataStore = "connected-subscribers-map"
	EventCountStore               DataStore = "event-count-store"
	ClaimedRewardStore            DataStore = "claimed-reward-store"
	P2PDhtStore                   DataStore = "p2p-data-store"
	SystemStore                   DataStore = "system-store"
)
View Source
const ADDRESS_ZERO = "0000000000000000000000000000000000000000"
View Source
const (
	DefaultPKeyPath string = "./data/.local.key"
)
View Source
const MaxBlockSize = 1000
View Source
const (
	NETWORK_NAME = "mlayer" // time interval within which to accept a handshake
)
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>
`))
View Source
var VALID_PROTOCOLS = []string{"/mlayer/1.0.0"}

Functions

This section is empty.

Types

type AuthorizationPrivilege

type AuthorizationPrivilege uint8
const (
	UnauthorizedPriviledge AuthorizationPrivilege = 0
	BasicPriviledge        AuthorizationPrivilege = 10
	StandardPriviledge     AuthorizationPrivilege = 20
	ManagerPriviledge      AuthorizationPrivilege = 30
	AdminPriviledge        AuthorizationPrivilege = 40
)

type ChannelId added in v1.2.0

type ChannelId string

Channel Ids within main context

const (
	ConfigKey ChannelId = "Config"
	SQLDB     ChannelId = "sqldb"
)

type DataStore

type DataStore string

type DataType added in v1.2.0

type DataType = string
const (
	BINARY   DataType = ""
	HTML     DataType = "html"
	HTM      DataType = "htm"
	SHTML    DataType = "shtml"
	CSS      DataType = "css"
	XML      DataType = "xml"
	GIF      DataType = "gif"
	JPEG     DataType = "jpeg"
	JPG      DataType = "jpg"
	JS       DataType = "js"
	ATOM     DataType = "atom"
	RSS      DataType = "rss"
	MML      DataType = "mml"
	TXT      DataType = "txt"
	JAD      DataType = "jad"
	WML      DataType = "wml"
	HTC      DataType = "htc"
	PNG      DataType = "png"
	TIF      DataType = "tif"
	TIFF     DataType = "tiff"
	WBMP     DataType = "wbmp"
	ICO      DataType = "ico"
	JNG      DataType = "jng"
	BMP      DataType = "bmp"
	SVG      DataType = "svg"
	WEBP     DataType = "webp"
	WOFF     DataType = "woff"
	JAR      DataType = "jar"
	WAR      DataType = "war"
	EAR      DataType = "ear"
	JSON     DataType = "json"
	HQX      DataType = "hqx"
	DOC      DataType = "doc"
	PDF      DataType = "pdf"
	PS       DataType = "ps"
	EPS      DataType = "eps"
	AI       DataType = "ai"
	RTF      DataType = "rtf"
	M3U8     DataType = "m3u8"
	KML      DataType = "kml"
	KMZ      DataType = "kmz"
	XLS      DataType = "xls"
	EOT      DataType = "eot"
	PPT      DataType = "ppt"
	ODG      DataType = "odg"
	ODP      DataType = "odp"
	ODS      DataType = "ods"
	ODT      DataType = "odt"
	PPTX     DataType = "pptx"
	XLSX     DataType = "xlsx"
	DOCX     DataType = "docx"
	WMLC     DataType = "wmlc"
	SEVEN_Z  DataType = "7z"
	CCO      DataType = "cco"
	JARDIFF  DataType = "jardiff"
	JNLP     DataType = "jnlp"
	RUN      DataType = "run"
	PL       DataType = "pl"
	PRC      DataType = "prc"
	RAR      DataType = "rar"
	RPM      DataType = "rpm"
	SEA      DataType = "sea"
	SWF      DataType = "swf"
	SIT      DataType = "sit"
	TCL      DataType = "tcl"
	DER      DataType = "der"
	XPI      DataType = "xpi"
	XHTML    DataType = "xhtml"
	ZIP      DataType = "zip"
	BIN      DataType = "bin"
	MID      DataType = "mid"
	MP3      DataType = "mp3"
	OGG      DataType = "ogg"
	M4A      DataType = "m4a"
	RA       DataType = "ra"
	THREE_GP DataType = "3gp"
	TS       DataType = "ts"
	MP4      DataType = "mp4"
	MPEG     DataType = "mpeg"
	MOV      DataType = "mov"
	WEBM     DataType = "webm"
	FLV      DataType = "flv"
	M4V      DataType = "m4v"
	MNG      DataType = "mng"
	ASF      DataType = "asf"
	WMV      DataType = "wmv"
	AVI      DataType = "avi"
)

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
)

Subscription 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 NodeType added in v1.2.0

type NodeType uint
const (
	ValidatorNodeType NodeType = 1
	SentryNodeType    NodeType = 2
)

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 SubscriberRole added in v1.2.0

type SubscriberRole uint8
var (
	TopicReaderRole  SubscriberRole = 0
	TopicWriterRole  SubscriberRole = 10
	TopicManagerRole SubscriberRole = 20
	TopicAdminRole   SubscriberRole = 30
)

type SubscriptionStatus added in v1.2.0

type SubscriptionStatus int16
var (
	UnsubscribedSubscriptionStatus SubscriptionStatus = 0
	InvitedSubscriptionStatus      SubscriptionStatus = 10
	PendingSubscriptionStatus      SubscriptionStatus = 20
	SubscribedSubscriptionStatus   SubscriptionStatus = 30
	// ApprovedSubscriptionStatus      SubscriptionStatus = "approved"
	BannedSubscriptionStatus SubscriptionStatus = 40
)

Jump to

Keyboard shortcuts

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