WireGuard Primer


WireGuard 1 is a simple, fast, and modern VPN that utilizes cryptography.

It encapsulates IP packets over UDP. The general workflow can be summarized as:

  • Install WireGuard
  • Add a WireGuard interface (like wlan0/eth0 but named wg0/wg1…)
  • Configure the interface with a private key and optionally add peer’s public key(s)
  • Send packets to the interface

It’s similar to the ssh model. Both parties have each other’s public keys and they communicate by exchanging packets encrypted by the public keys through the WireGuard interface.

  1. https://www.wireguard.com/ 

Value-Parameterized GTest


Last time I talked about gtest in the gtest primer, and in this post we discuss the usage of “value-paramterized” tests. In general, when you write a simple test case and verified it is working, what is the next step? Maybe you want to add more test cases! But how? Adding them by “hard-coding” the logics in the source files? It’s not a good idea since cases may evolve and we may later add new corner cases, maybe months later. At that time, you may already forgot how to write a test case using gtest.

Value-parameterized tests are a good way to organize your test cases and group them in a logical manner e.g. test cases for a particular API. I use value-parameterized tests and a YAML configuration file to dynamically add/reduce my test cases, so that adding or removing a test case is as simple as updating the YAML file.

Git Primer

Git Primer

Git Commit Messages

Git commit messages can help you understand why something happened months or years ago for your collaborators or yourselves. It affects a project’s maintainability, and hence plays a critical role in a project’s long-term success.

This section we summarize some common techniques to write a healthy commit message. Of course there are variations on the styles and conventions adopted by different projects/orgs, you should pick one and stick to it as much as possible to reduce chaos and inconsistency.

Boost.Log Primer

Boost Log 1

Prepare the namespace aliases

namespace logging = boost::log;
namespace sinks = boost::log::sinks;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
namespace attrs = boost::log::attributes;
namespace keywords = boost::log::keywords;
  1. https://www.boost.org/doc/libs/1_63_0/libs/log/doc/html/index.html 

GoogleTest Primer

GoogleTest 1 Primer (gtest)

What is GoogleTest

Googletest is a testing framework to help write better C++ code

  • supports any kind of tests, not just unit tests
  • based on the popular xUnit (e.g. JUnit, PyUnit) architecture
  1. https://github.com/google/googletest/blob/master/googletest/docs/primer.md