开发者

How to handle IPv6 in IRC's DCC protocol

开发者 https://www.devze.com 2023-03-30 15:54 出处:网络
In IRC DCC communications to initiate a connection you have to provide an IP address and a port to the other person. However, how do you handle this in an IPv6 world?

In IRC DCC communications to initiate a connection you have to provide an IP address and a port to the other person. However, how do you handle this in an IPv6 world?

I'm writing the IRC framework part of the bot in Java, so I need to be able to handle various situations. There doesn't seem to be a standard way to handle this

I did some tests with existing clients over IPv6 (two Teredo clients connecting to freenode over Ipv6

  • Chatzilla in Firefox doesn't send anything. It just acts like nothing happened
  • Xchat just sends 0 as an IP address, which is wrong.

I know that there are some extensions to the DCC protocol that send the IP address in human readable format, but those aren't standard nor widely supported. Sending 0 doesn't seem like the appropriate way to future proof my bot.

Right now I'm converting the IPv6 address to a BigInteger, but on the other end figuring out if the BigInteger is an IPv4 or IPv6 address is stumping me (I'm asking how to do that later).

TL;DR: What's the appropriate way to handle DCC in an IPv6 environment? Should I send 0, should I 开发者_高级运维not send anything at all and raise exceptions in the bot that its unsupported, or should I send the monster BigInteger?


There's no official RFC for DCC, so the only real definitive document is the original CTCP spec:

http://www.irchelp.org/irchelp/rfc/ctcpspec.html

Which kind of assumes IPv4:

The address, port, and size should be sent as ASCII representations of the decimal integer formed by converting the values to host byte order and treating them as an unsigned long, unsigned short, and unsigned long respectively.

You may want to check what mIRC and irssi do, as they're more commonly used than Chatzilla and XChat, and may have come up with some sort of mutually acceptable solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号