Perf Cheat Sheet

Network utilization process breakdown Network utilization process breakdown

How To Debug Golang Test Functions with Delve

https://github.com/go-delve/delve Delve is a debugger for the Go programming language Let’s say I have a package named actuallykasi/pkg/sample/v1/api. Inside this package there is test function TestGetCurrencyHandler as follows. 199func TestGetCurrencyHandler(t *testing.T) { 200 router := mux.NewRouter() 201 tests := []struct { 202 Name string 203 Method string 204 URL string 205 WantCode int 206 WantResponse []byte 207 }{ 208 { 209 Name: "InvalidCurrency", 210 URL: "/currency", 211 WantCode: http.

Golang Emedding

What are go pointers? Ref: https://golang.org/doc/effective_go.html#pointers_vs_values

Go Builder Pattern

Some objects are simple and can be created in single constructor call. Other objects require a lot of ceremondy to create. Peice wise construction. builder provides an API for constructing an object step-by-step. type PersonBuilder struct{ person *Person } func (b *PersonBuilder) Lives() *PersonAddressBuilder{ return PersonAddressBuilder{*b} } func NewPersonBuilder() *PersonBuilder{ return &PersonBuilder{&Person{}} } type PersonAddressBuilder struct{ PersonBuilder }

Go Design Patterns

SOLID Design priciples by Rober C. Martin Single Responsibility principle Open-Closed Principle Liskov Substitution Principle Interface segregation Principle Dependency Inversion Principle Single Responsibility principle A type should have one responisibility. Seperation of concerns. God object a terrible idea! Open-Closed Principle OCP Open for extenstion, Closed for modification. Specification pattern. Liskov Substitution Priciple Interface Segregation Principle You shouldn’t put too much into interface. Smaller interface the better. Dependency Inversion Principle High level Module (HLM) should not depend on LLM.

How To Add DHCP Static Map in Edgerouter

EdgeRouter uses ISC DHCP server by default. Check the current configuration ubnt@ubnt:~$ configure [edit] ubnt@ubnt# show service dhcp-server disabled false hostfile-update disable shared-network-name LAN { authoritative enable subnet 192.168.1.0/24 { default-router 192.168.1.1 dns-server 1.1.1.1 lease 86400 start 192.168.1.38 { stop 192.168.1.243 } } } static-arp disable use-dnsmasq disable [edit] Edit config ubnt@ubnt# edit service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 [edit service dhcp-server shared-network-name LAN subnet 192.168.1.0/24] We are going to add a static entry for my second router which has IP address 192.

Edgerouter_configuring_dns_over_tls

Why Do I need DNS over TLS/SSL? I am already using privacy first 1.1.1.1 as my DNS resolver. My DNS queries are still unencrypted. Tcpdump on edgerouter shows which queries my home devices making continously. ubnt@ubnt:~$ sudo tcpdump -i eth0 host 1.1.1.1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes 08:30:20.440277 IP 143.142.86.116.starhub.net.sg.46173 > one.one.one.one.domain: 47433+ AAAA?

Adding Debian Repo On Ubiquity Edgerouter

Login to the console and check current version ubnt@ubnt:~$ show version Version: v1.10.7 Build ID: 5127989 Build on: 10/01/18 12:27 Copyright: 2012-2018 Ubiquiti Networks, Inc. HW model: EdgeRouter X 5-Port HW S/N: XXXXXXX Uptime: 01:51:09 up 1:03, 1 user, load average: 1.15, 1.11, 1.12 From https://help.ubnt.com/hc/en-us/articles/205202560-EdgeRouter-Add-Debian-Packages-to-EdgeOS The underlying Debian distribution has been upgraded from Wheezy to Stretch in the v2.0.0 EdgeOS firmware release. This means that the Debian repository used between EdgeOS v2.

Getting Started With Ubiquity Edgerouter

Why do I need an Edgerouter? Ubquity’s near enterprise grade linux router gives you fine grain control over your home routing. I can think of several usecases such as Put entire/some traffic under vpn so I don’t need a vpn client working in every device I am using. Run my personal site (actualykasi.com) from edgerouter so I can cut down hosting costs. (More on how I achieved that in upcoming blog post) Play ground for vlan, nat, bgp and ospf etc.