Due to the novelty factor, I decided to get my software projects to build and pass the tests there. I set up a local FreeBSD VirtualBox VM to test something, and it seems to work very well. # What I learned from porting my projects to FreeBSD
Long story to short, reading classical source code is a rewarding process, and you can consider to try it yourself.
Therefore I develop a simple C++ library which wraps the libtls and hope it can free developer from this troublesome problem and put more energy in application logic part.
OpenBSD‘s netcat supports tls/ssl connection, but it needs you take full care of resource management (memory, socket, etc), otherwise a small mistake can lead to resource leak which is fatal for long-live applications (In fact, the two bugs I reported to OpenBSD are all related resource leak). (4) Implement a C++ encapsulation of libtls. Though trivial contributions to OpenBSD, I am still happy and enjoy it. During reading code, I also found bugs and some enhancements. IMHO, this “tutorial” doesn’t really mean teach others something, but just a journal which I can refer when I need in the future. So I just take notes of what I think is useful. I am mediocre programmer and will forget things when I don’t use it for a long time. Even though I don’t write socket related code now, reading netcat socket code indeed refresh my knowledge and teach me new stuff. Just ~10 functions (socket, bind, listen, accept…) with some IO multiplexing buddies (select, poll, epoll…) connect the whole world, wonderful! From that time, I developed a habit that is when touching a new programming language, network programming is an essential exercise. I wrote my first network application more than 10 years ago, and always think the socket APIs are marvelous. Fortunately, in the past 2 months, I was not so busy that I can spend my spare time to dive into OpenBSD‘s netcat source code, and got abundant byproducts during this process.
During that class, the tutor showed some hacks and tricks of using netcat which appealed to me and motivated me to learn the guts of it. When I took part in a training last year, I heard about netcat for the first time. # The byproducts of reading OpenBSD netcat code Byproducts of reading OpenBSD’s netcat code, learnings from porting your own projects to FreeBSD, OpenBSD’s unveil(), NetBSD’s Virtual Machine Monitor, what 'dependency' means in Unix init systems, jailing bhyve, and more.