lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

IPv6 support #32

Closed queezle42 closed 5 years ago

queezle42 commented 9 years ago

Google Code Issue 175: IPv6 support

I have modified the library to support IPv6 dual mode by changing the socket configuration and by mapping any IPv4 addresses handled to the Connect- and ActuallySendPacket-methods to IPv6 addresses using NetAddress.MapToIPv6(). I have also changed the the default LocalAddress to IPAddress.IPv6Any and have modified the NetUtility.Resolve to also resolve IPv6 addresses.

All unit tests pass and I can connect to a NetServer with LocalAddress = IPAddress.IPv6Any by using an IPv4 address (e.g. 127.0.0.1) as well as an IPv6 address (e.g. ::1).

The biggest "drawback" with this implementation is that internally all addresses are handled as IPv6 addresses. This is especially apparent when it comes to debug output; you will see lines like:

Socket bound to [::ffff:127.0.0.1]:53662: True

I'm new to collaborating via GitHub, but if you are interested in applying the changes I could probably figure out a way to create a pull request :)

lidgren commented 9 years ago

I am. Create a pull request, or just zip it up and mail it to me :-)