<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Goland on opium.io</title><link>https://opium.io/tags/goland/</link><description>Recent content in Goland on opium.io</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 03 Dec 2019 21:44:11 +0100</lastBuildDate><atom:link href="https://opium.io/tags/goland/index.xml" rel="self" type="application/rss+xml"/><item><title>Parsing RATP's json API with Golang</title><link>https://opium.io/blog/json-ratp-in-go/</link><pubDate>Tue, 03 Dec 2019 21:44:11 +0100</pubDate><guid>https://opium.io/blog/json-ratp-in-go/</guid><description>&lt;h2 id="accessing-the-rapts-api"&gt;&lt;a class="anchor" href="#accessing-the-rapts-api"&gt;Accessing the RAPT&amp;rsquo;s API.&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;If you want a direct access to RATP&amp;rsquo;s open data API, you&amp;rsquo;ll need to fill a pdf form and send it to an email address. I tried and never heard back of them. So I used &lt;a href="https://api-ratp.pierre-grimaud.fr"&gt;https://api-ratp.pierre-grimaud.fr&lt;/a&gt; in order to access real time schedules. Thank-you to Pierre Grimaud for providing this really cool alternative. The documentation of the API is pretty straightforward and it&amp;rsquo;s only a matter of finding the right station along its slug name. For example:&lt;br&gt;&#10;&lt;code&gt;curl -X GET &amp;quot;https://api-ratp.pierre-grimaud.fr/v4/stations/buses/58&amp;quot;&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Mqtt in go with paho</title><link>https://opium.io/blog/mqtt-in-go/</link><pubDate>Sat, 18 Feb 2017 00:14:23 +0100</pubDate><guid>https://opium.io/blog/mqtt-in-go/</guid><description>&lt;h2 id="but-why"&gt;&lt;a class="anchor" href="#but-why"&gt;But why?&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I wanted to play with MQTT and TLS and that&amp;rsquo;s about it… I decided to go with golang. Mainly because I never tried the language before and because I wanted a single binary with no dependencies and C was not even an option (I’m too old for this shit).&lt;/p&gt;&#10;&lt;h3 id="why-not-using-client-cert-authentication"&gt;&lt;a class="anchor" href="#why-not-using-client-cert-authentication"&gt;Why not using client cert authentication?&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;While client authentication using public key is nice, I didn&amp;rsquo;t feel it brings enough added security in order for me to go through the hassle of having to manage a full PKI (as well as delivering client certificates) for a pet project. Authenticating the server using public key and the client using a login and password is plenty enough for a simple &amp;ldquo;I&amp;rsquo;m alive&amp;rdquo; mqtt publisher. However, there is a hmac function in order to ensure that a rogue client cannot impersonate another one (this needs to be set before each go build, obviously…). This requires some provisionning on server side obviously so both parties use the same psk for the hmac.&lt;/p&gt;</description></item></channel></rss>