Commit Graph

75 Commits

Author SHA1 Message Date
Kleissner
db46b80e3f Move ping code to separate file (no changes) 2021-05-09 15:37:32 +02:00
Kleissner
f084edc316 New function record.IsBadQuality to make sure bad peers returned in the Response message are not considered.
Improved remote peer NAT detection. Placeholder for sending the Traverse message.
Fix in handling incoming FIND_PEER request. Do not return self as closest node.
Do not share peers for which the internal port is not known.
2021-05-09 00:49:34 +02:00
Kleissner
f70875a345 Use PortReportedExternal when available. 2021-05-08 17:25:20 +02:00
Kleissner
530cd541c1 Add new fields Port Internal and Port External to the exchanged peer record according to the latest Whitepaper 0.7.3.
This allows peers to detect each other's NAT and port forwarding status.
2021-05-08 13:03:45 +02:00
Kleissner
3a502a1ecc Minor UPnP improvement: Run discovery of each network in parallel. 2021-05-07 01:05:02 +02:00
Kleissner
5f8f299799 Working UPnP code. Close #16 2021-05-06 14:57:40 +02:00
Kleissner
eb0afce3f9 Fix race condition in cmdResponse. 2021-05-06 14:54:28 +02:00
Kleissner
e929d6ba2f Make result channel buffered. Function QueueResult to queue the incoming message non-blocking.
This fixes a bug (write on closed channel).
2021-05-06 14:48:34 +02:00
Kleissner
4df71d531f Add basic forked UPnP library. More changes upcoming. #16 2021-05-05 21:35:32 +02:00
Kleissner
f1da49d68e Add PortForward setting to override external listening port. Improve default config inline documentation.
Prepare EnableUPnP setting.
2021-05-04 12:43:31 +02:00
Kleissner
0fe2ce60ec Add reported internal and external port to Connection. New function peer.IsBehindNAT.
PeerlistAdd is now called on every incoming message. User Agent fixes.
2021-05-04 01:13:11 +02:00
Kleissner
f3c9d5e17f Add new fields Port Internal and Port External to the Announcement/Response message according to the latest Whitepaper 0.7.3.
These fields will be used for NAT detection and UPnP support.
2021-05-03 14:05:07 +02:00
Kleissner
948fa2be91 Add placeholder for future code 2021-05-03 11:00:17 +02:00
Kleissner
1e7bb0c40c Fix #19 IPv4 address format in byte form 2021-04-25 22:12:59 +02:00
Kleissner
250f60a4b6 New flag: IsRootPeer. Rearranged initialization priority (initNetwork should always be last). 2021-04-25 05:34:00 +02:00
Kleissner
35f50230cd Add 2 root peers. New seed list auto update. 2021-04-25 04:40:45 +02:00
Kleissner
f13695709f Kademlia: Initial bucket refresh implementation. This might be improved down the road. 2021-04-25 04:22:10 +02:00
Kleissner
611dfa3b1c RefreshBuckets: Use self ID on bucket 0. 2021-04-25 03:44:52 +02:00
Kleissner
1c03afd63b Fix: Check if channel is closed. 2021-04-25 00:07:53 +02:00
Kleissner
63e736486a Implement auto refresh of buckets. Close #11 2021-04-24 23:06:08 +02:00
Kleissner
6693d442a6 Add function dht.RefreshBuckets. Use RW mutex for accessing hash table. 2021-04-24 22:42:39 +02:00
Kleissner
146bb6991e Proper ShouldEvict implementation 2021-04-22 06:11:39 +02:00
Kleissner
27152cb145 Provide old and new peer in ShouldEvict. New comparison function IsNodeCloser.
Remove unused code (which was likely buggy anyway).
2021-04-22 05:45:46 +02:00
Kleissner
4b905f4eab Enable local peer discovery for public IPv4s for now. 2021-04-21 03:42:46 +02:00
Kleissner
ec809029d8 Sequences add pointer to high-level data. Proper mapping of sequences to information requests. 2021-04-21 03:27:03 +02:00
Kleissner
e432696ad1 dht.Get return sender's nodeID 2021-04-21 03:06:30 +02:00
Kleissner
8a33f19986 Remove unnecessary ListIR. Removes complexity. 2021-04-21 02:49:31 +02:00
Kleissner
0dd9ef028b Fix race condition in sequence validation and invalidation. Once they are now checked, they can be immediately invalidated. 2021-04-20 17:20:55 +02:00
Kleissner
8269219cf0 Fix sendAllNetworks: New sequence number per packet 2021-04-20 07:18:46 +02:00
Kleissner
62c4b370fc New announcementPacket structure to report back values up the chain 2021-04-20 05:25:56 +02:00
Kleissner
8bb1a3bdf7 GetRTT function 2021-04-19 15:32:14 +02:00
Kleissner
1eb4f4083b Implement SEQUENCE_LAST flag 2021-04-19 15:05:17 +02:00
Kleissner
b2db81143e Proper message sequence implementation for Response and Pong messages. Record round-trip time at connection level! Reply timeout. Close #13 #5
Fixes.
2021-04-19 05:18:07 +02:00
Kleissner
00db57aed8 Provide the new sequence number in responses. New message Local Discovery to be sent instead of Announcement via IPv4 Broadcast and IPv6 Multicast.
Detecting IPv6 link-local addresses as local ones. Fixes.
2021-04-18 21:50:30 +02:00
Kleissner
703e40c947 Add Sequence field #13 to packet header according to latest Whitepaper 0.7.1
The field is yet to be used.
2021-04-18 05:22:19 +02:00
Kleissner
a82f575816 Embed IsLast indicator in bit 15 of count of peer records field 2021-04-18 03:18:59 +02:00
Kleissner
ce2d3309af Update seed list. New function LoadConfigOut to parse main config into custom structure.
Remove reuseport module file (not needed).
2021-04-15 12:59:06 +02:00
Kleissner
6a9d167177 Module update 2021-04-10 16:06:55 +02:00
Kleissner
ff9804bf6d Start with the store code. Properly handle announcement requests.
Add core data functions: Data2Hash, GetData, GetDataLocal, GetDataDHT, StoreDataLocal, StoreDataDHT
2021-04-10 16:00:43 +02:00
Kleissner
96213d4ed9 Minor fixes. dht.Store and Get work now! 2021-04-10 15:43:56 +02:00
Kleissner
27ec231e14 Moving store code to nested module 2021-04-09 22:41:08 +02:00
Kleissner
e69589c5c8 Kademlia: Use information requests from updated DHT library. More testing & fixes upcoming. 2021-04-09 16:36:35 +02:00
Kleissner
c44e57a0a0 Add information request list to DHT structure. It keeps track of requests and matches responses.
Break up SendRequest into individual functions SendRequestStore and SendRequestFindNode, which improves readability.
Alpha parameter must be now passed. MarkNodeAsSeen is exported.
Breaking up dht.iterate and embedding into 3 functions Get, FindNode, and FindValue.
2021-04-09 16:07:20 +02:00
Kleissner
7927e18572 Add Connectivity documentation 2021-04-05 18:43:59 +02:00
Kleissner
b2cbe2d066 Support for feature bits: IPv4_LISTEN and IPv6_LISTEN
Share IPv4/IPv6 peer connections only if supported by the remote peer.
2021-04-05 14:58:47 +02:00
Kleissner
d83123bf46 dht.GetClosestContacts introduce custom filter function 2021-04-05 14:45:33 +02:00
Kleissner
f4473c6139 Add MIT license. Close #12
Note: This applies and affects only the core library.
2021-04-05 11:01:58 +02:00
Kleissner
b8e408048c Add byte to Announcement/Response to inform about sender's feature support. According to Whitepaper 0.7. 2021-03-17 11:40:20 +01:00
Kleissner
ddd3f65187 Fix in msgEncodeResponse when multiple peers are returned in a Response message 2021-03-17 02:56:17 +01:00
Kleissner
75c0d12850 Adding initial 2 root peers. The Peernet network is live! 16.03.2021 2021-03-16 23:04:28 +01:00