Send peer discovery announcements over ipv6 multicast #3

Merged
mirsal merged 1 commits from mirsal/cosmoline:ipv6 into main 2021-04-01 12:52:22 +02:00
Collaborator

The current SSB protocol is ipv4-only according to the SSB Protocol Guide, although I would like to extend it so it supports operation over IPv6.

Changes in the protocol would be minimal:

  • peer discovery announcements should also be sent to to the all-nodes link-local multicast group FF02::2
  • peer discovery messages should support advertising an IPv6 address (caveat: The field delimiter is :)
  • peer discovery listeners should bind to IPv6
  • tcp protocol listeners should accept connections over IPv6

Let's implement it so we have a working implementation before proposing those changes to the protocol maintainers

See: #7

The current SSB protocol is ipv4-only according to the [SSB Protocol Guide](https://ssbc.github.io/scuttlebutt-protocol-guide/), although I would like to extend it so it supports operation over IPv6. Changes in the protocol would be minimal: * [x] peer discovery announcements should also be sent to to the [all-nodes link-local multicast group](https://tools.ietf.org/html/rfc4291#section-2.7.1) `FF02::2` * [ ] peer discovery messages should support advertising an IPv6 address (caveat: The field delimiter is `:`) * [x] peer discovery listeners should bind to IPv6 * [ ] tcp protocol listeners should accept connections over IPv6 Let's implement it so we have a working implementation before proposing those changes to the protocol maintainers See: #7
mirsal added 3 commits 2021-03-29 22:05:45 +02:00
458ff680ec Add async_std dependencies
This commit adds the required dependencies for switching to async_std
for non-blocking asynchronous I/O
3195de3d5f Switch to non-blocking asynchronous I/O with async_std
* main: add a basic main loop and make the network part async
 * keypair: do not block when writing the generated keyfile
 * keypair: Read the secret file asynchronously
9c0bc7c5c1 Bind to IPv6
The Future
mirsal force-pushed ipv6 from 9c0bc7c5c1 to 0405ec3b16 2021-03-30 19:56:33 +02:00 Compare
mirsal changed title from WIP: IPv6 to IPv6 2021-03-30 19:59:08 +02:00
mirsal changed title from IPv6 to Listen on IPv6 for peer discovery broadcasts 2021-03-30 20:03:16 +02:00
mirsal changed title from Listen on IPv6 for peer discovery broadcasts to WIP: IPv6 support 2021-03-30 20:21:08 +02:00
mirsal force-pushed ipv6 from 0405ec3b16 to 376ad62364 2021-03-30 20:23:28 +02:00 Compare
Owner

Extending the protocol is so exciting! 😄

Extending the protocol is so exciting! 😄
mirsal was assigned by ryzokuken 2021-03-31 08:48:02 +02:00
mirsal added 6 commits 2021-03-31 23:30:34 +02:00
c59ea85329 Quick and dirty peer discovery broadcast mock implementation
* Use `async_std::task` for network loops
 * Send the generated public key over ipv4 udp broadcast frames

(peer discovery is not functional yet, although multiple instances
connected to the same link can now talk to each other, so yay.)
mirsal force-pushed ipv6 from ec43ca01c6 to 893e75cbf5 2021-03-31 23:32:18 +02:00 Compare
mirsal added a new dependency 2021-03-31 23:34:44 +02:00
mirsal force-pushed ipv6 from 893e75cbf5 to a49c5123ae 2021-04-01 07:35:41 +02:00 Compare
mirsal changed title from WIP: IPv6 support to WIP: Send peer discovery announcements to the all-nodes link-local ipv6 multicast group 2021-04-01 07:40:01 +02:00
mirsal changed title from WIP: Send peer discovery announcements to the all-nodes link-local ipv6 multicast group to WIP: Send peer discovery announcements over ipv6 multicast 2021-04-01 07:40:28 +02:00
mirsal added 1 commit 2021-04-01 07:44:12 +02:00
mirsal force-pushed ipv6 from 779ff7aeca to 593d0a11e7 2021-04-01 07:45:31 +02:00 Compare
mirsal changed title from WIP: Send peer discovery announcements over ipv6 multicast to Send peer discovery announcements over ipv6 multicast 2021-04-01 07:46:29 +02:00
mirsal requested review from ryzokuken 2021-04-01 07:46:36 +02:00
ryzokuken approved these changes 2021-04-01 09:37:55 +02:00
ryzokuken left a comment
Owner

Just one comment!

Just one comment!
src/main.rs Outdated
@ -15,8 +15,11 @@ type Config = toml::map::Map<String, toml::Value>;
async fn peer_discovery_recv() {
let socket = UdpSocket::bind(":::8008").await.unwrap();
let all_nodes_addr = Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0x02);
Owner

Can this just be done inline in the line below instead?

Can this just be done inline in the line below instead?
mirsal marked this conversation as resolved
src/main.rs Outdated
@ -18,2 +18,4 @@
let all_nodes_addr = Ipv6Addr::new(0xFF02, 0, 0, 0, 0, 0, 0, 0x02);
let mut buf = [0u8; 1024];
socket.join_multicast_v6(&all_nodes_addr, 0).unwrap();
Owner

I think instead of adding Ipv6Addr::new here with all the args and use-ing that struct, you can just do "[FF02::2]".parse() (dunno the exact string address but yeah) instead.

I think instead of adding `Ipv6Addr::new` here with all the args and `use`-ing that struct, you can just do `"[FF02::2]".parse()` (dunno the exact string address but yeah) instead.
mirsal marked this conversation as resolved
mirsal force-pushed ipv6 from 593d0a11e7 to 6d3deb9e58 2021-04-01 12:49:11 +02:00 Compare
mirsal force-pushed ipv6 from 6d3deb9e58 to 870c27261c 2021-04-01 12:50:54 +02:00 Compare
Author
Collaborator

there, fixed it :3

there, fixed it :3
mirsal merged commit 52862bbace into main 2021-04-01 12:52:22 +02:00
mirsal deleted branch ipv6 2021-04-01 12:54:37 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Depends on
#5 Peer discovery broadcast
ryzokuken/cosmoline
Reference: ryzokuken/cosmoline#3
No description provided.