github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/ChaparKhane/router-connection.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package chaparkhane 4 5 import "../crypto" 6 7 // routerConnection store router to router connection 8 type routerConnection struct { 9 /* Connection data */ 10 XPID uint32 11 RouterID uint32 // Part of GP that lease by routers! 12 Status uint8 // States locate in this file. 13 Weight uint8 // 16 queue for priority weight of the connections exist. 14 MaxBandwidth uint64 // Peer must respect this, otherwise connection will terminate and User go to black list! 15 16 /* Peer data */ 17 Path []byte // Chapar switch spec 18 ReversePath []byte // Chapar switch spec 19 AlternativePath [][]byte 20 ThingID [16]byte 21 22 /* Security data */ 23 PeerPublicKey [32]byte 24 Cipher crypto.Cipher // Selected cipher algorithms https://en.wikipedia.org/wiki/Cipher_suite 25 26 /* Metrics data */ 27 BytesSent uint64 // Counts the bytes of payload data sent. 28 PacketsSent uint64 // Counts packets sent. 29 BytesReceived uint64 // Counts the bytes of payload data Receive. 30 PacketsReceived uint64 // Counts packets Receive. 31 FailedPacketsReceived uint64 // Counts failed packets receive for firewalling server from some attack types! 32 } 33 34 // routerConnection Status 35 const ( 36 // routerConnectionStateClosed indicate connection had been closed 37 routerConnectionStateClosed uint8 = iota 38 // routerConnectionStateOpen indicate connection is open and ready to use 39 routerConnectionStateOpen 40 // routerConnectionStateRateLimited indicate connection limited due to higher usage than permitted! 41 routerConnectionStateRateLimited 42 // routerConnectionStateOpening indicate connection plan to open and not ready to accept stream! 43 routerConnectionStateOpening 44 // routerConnectionStateClosing indicate connection plan to close and not accept new stream 45 routerConnectionStateClosing 46 // routerConnectionStateNotResponse indicate peer not response to recently send request! 47 routerConnectionStateNotResponse 48 )