By Kevin
Category: misc

The other day on IRC, the bot for one of the channels I frequent reconnected, and I noticed it was coming in over IPv4. I knew the host it was on is IPv6 capable, so I jokingly asked it "y u no ipv6?". The bot's owner told me "patches welcome" and pointed me at the bot's source. Now, some of you recall I cringe a bit when someone says that to me, but I decided to poke around.

As it turns out, the bot in question, called Jenni, is written in Python. I have a modicum of experience in Python, so I decided to dig in. Sure enough, there in the connect function was the dreaded AF_INET socket creation. At the bottom of the socket documentation are examples on how to write a connection function that can do both IPv4 and IPv6. getaddrinfo() is your friend.

Having never submitted any code on GitHub (which still doesn't have IPv6), I had to fumble my way through the procedures. Nevertheless, 45 minutes after "patches welcome", I had a pull request submitted to the author. I like to tell people "I don't patch code. I patch developers," but sometimes you just have to show 'em how it's done. My code was merged the next day.

As I write this, it occurs to me that some of you might not get the reference in the title of this post. See Wikipedia for clarification.

Logo courtesy FreeSVG Proudly hosted on Linode ⋅ Inspired by Telstar Logistics