Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Credential ¶
Credential returns a credential to identity the Peer, which contains the expiration time and the reclaimed IP address. All requests relevant to IP address, the credential is required. We will verify the triple: -> (PeerID, IP, Expiration). The schema of credential: | PeerID | IP | Expiration | | 8 bytes | 4 bytes | 8 bytes | The credential delivered to the client will be encrypted by secret key. The secret key is a private key only hold by the gateway.
Types ¶
type Error ¶
type Error struct { Code message.StatusCode Err error }
Error represent a dedicated error type, which contain the API status code
type Options ¶
type Options struct { AuthOptions *security.AuthOptions Host string Port int Concurrency int TLSCert string TLSKey string CIDR string }
Options represents the CLI arguments of Zetamesh gateway node
type PeerInfo ¶
type PeerInfo struct { ID int64 NetworkID string VirtAddress string UDPAddress string HeartbeatAt time.Time ExpirationAt time.Time }
PeerInfo represents the peer of the Zetamesh system. The following fields should be immutable: ID, NetworkID, VirtAddress.
type PeerStore ¶
type PeerStore interface { // Find tries to find the peer information from peer store. Find(networkID, addr string) (*PeerInfo, error) // Get gets the information of the peer by ID. Get(id int64) (*PeerInfo, error) // Put stores the Peer into the store and the latest ID of the // peer will be assigned to the peer. Put(peer *PeerInfo) error // Delete deletes the peer by peer ID from peer store. Delete(id int64) error // Subnet returns all peers included in the subnet Subnet(networkID string) ([]*PeerInfo, error) }
PeerStore represents the store that is used to store peers information.