Skip to content

2024

Go Reflect: Correctly Get an Empty Interface Type

This blog records the tricky part of using reflect to get an empty interface type correctly. The background is that a component requires the configuration type during function call as it might use the type to construct a type and set up the value based on some external data set. If we cannot find a respective in some scenarios, empty interface type should be passed.

However, at the beginning due to the wrong usage of reflect, a nil type instead of interface{} type is passed by reflect.TypeOf(i).

var i interface{}
// this is correct
typ := reflect.TypeOf(&i).Elem()

// this is wrong usage, the typ is nil
typ := reflect.TypeOf(i)

Migration from Docker to OrbStack

Recently, my company abandoned docker desktop because it requires the company to paid for its services. As a result, the company treats as an unnecessary cost and asks the developers to find another alternatives. This blog records the troublesome during my migration.

HTTP/2 Main Points

This blog is the reading notes for the book HTTP/2 in Action. It requires the knowledge of HTTP/1.1 as I will only show the drawbacks of HTTP/1.1 the HTTP/2 intends to solve.

The book itself is nice, and cover all the main features with details. The only problem is the epub book has lost several diagrams and the contents of frames occupied a few pages while reading in my Kindle:(

Handshake in TLS 1.3

This blog writes the takeaway notes of the TLS 1.3 handshake. To understand it, several basic crypto algorithms are required, such as SHA(security hash algorithm), DHE(Diffie-Hellman Exchange), KDF(key derivation function), DSA(digital signature algorithm) and AES. Moreover, understanding the PKI(public key infrastructure) is needed as well.

In this blog, the fundamental math formulas are not the focused parts. Instead, we focus on the whole workflow. The full details are stipulated by the rfc8446.