indra-labs / indra

Distributed Virtual Private Network Powered By Bitcoin Lightning
Creative Commons Zero v1.0 Universal
49 stars 7 forks source link

Change transport.NewListener to use []multiaddr.Multiaddr instead of []string #6

Closed l0k18 closed 1 year ago

l0k18 commented 1 year ago

Avoids a lot of unnecessary transformations. The binary codec of multiaddr is probably more efficient and obvious for the wire encoding. There is quite a few places where netip.AddrPort is being used so this is a fairly extensive refactor.

l0k18 commented 1 year ago

At the very last part of getting this done, the Reverse messages and the size of the headers being now variable has come up. Previously it was fixed, with netip.AddrPort slice length of 18, being 16 bits IPv6 address and 2 bytes port number, the encoding was fixed, now it is variable.

As such, the entire edifice of the splitting between header and payload has to be rewritten and a new message type needs to be added below the crypt to indicate the payload offset.

This was going to be done afterwards but it now proves to be completely necessary to do now.