status-go/services/mailservers
Andrea Maria Piana d60a6713fe Enable mailserver cycle by default
This commit enables mailserver cycle logic by default and make a few
changes:

1) Nodes are graylisted instead of being blacklisted for a set amount of
   time. The reason is that if we blacklist, any cut in connectivity
   might result in long delays before reconnecting, especially on spotty
   connections.

2) Fixes an issue on the devp2p server, whereby the node would not
   connect to one of the static nodes since all the connection slots
   where filled. The fix is a bit inelegant, it always connects to
   static nodes, ignoring maxpeers, but it's tricky to get it to work
   since the code is clearly not written to select a specific node.

3) Adds support to pinned mailservers

4) Add retries to mailservers requests. It uses a closure for now, I
   think we should eventually have a channel etc, but I'd leave that for
   later.
2022-03-19 08:56:22 +00:00
..
README.md remove eth.beta fleet as it has been decomissioned 2020-02-21 14:48:47 +01:00
api.go Clean topics that we don't listen to 2021-01-26 09:39:57 +01:00
api_test.go Enable mailserver cycle by default 2022-03-19 08:56:22 +00:00
database.go Enable mailserver cycle by default 2022-03-19 08:56:22 +00:00
fleet.go Enable mailserver cycle by default 2022-03-19 08:56:22 +00:00
service.go Fix some tests and restore private/public RPC client 2021-07-20 10:57:38 +02:00
tcp_ping.go fix: mailserver response time (#2486) 2022-01-13 10:30:00 -04:00

README.md

Mailservers Service

Mailservers service provides read/write API for Mailserver object which stores details about user's mailservers.

To enable this service, include mailservers in APIModules:

{
  "MailserversConfig": {
    "Enabled": true
  },
  "APIModules": "mailservers"
}

API

Enabling service will expose three additional methods:

mailservers_addMailserver

Stores Mailserver in the database.

{
    "id": "1",
    "name": "my mailserver",
    "address": "enode://...",
    "password": "some-pass",
    "fleet": "prod"
}

mailservers_getMailservers

Reads all saved mailservers.

mailservers_deleteMailserver

Deletes a mailserver specified by an ID.

Mailserver requests gap service

Mailserver request gaps service provides read/write API for MailserverRequestGap object which stores details about the gaps between mailserver requests.

API

The service exposes four methods

mailserverrequestgaps_addMailserverRequestGaps

Stores MailserverRequestGap in the database. All fields are specified below:

{
  "id": "1",
  "chatId": "chat-id",
  "from": 1,
  "to": 2
}

mailservers_getMailserverRequestGaps

Reads all saved mailserver request gaps by chatID.

mailservers_deleteMailserverRequestGaps

Deletes all MailserverRequestGaps specified by IDs.

mailservers_deleteMailserverRequestGapsByChatID

Deletes all MailserverRequestGaps specified by chatID.

mailservers_addMailserverTopic

Stores MailserverTopic in the database.

{
    "topic": "topic-as-string",
    "chat-ids": ["a", "list", "of", "chatIDs"],
    "last-request": 1
}

mailservers_getMailserverTopics

Reads all saved mailserver topics.

mailservers_deleteMailserverTopic

Deletes a mailserver topic using topic as an identifier.

mailservers_addChatRequestRange

Stores ChatRequestRange in the database.

{
    "chat-id": "chat-id-001",
    "lowest-request-from": 1567693421154,
    "highest-request-to": 1567693576779 
}

mailservers_getChatRequestRanges

Reads all saved chat request ranges.

mailservers_deleteChatRequestRange

Deletes a chat request range by chat-id.