T i l
DHCP
I have seen this term here and there. I remember fiddling with this in pain of setting up port forwarding in xfinity/.
DHCP - Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks for automatically assigning IP addresses and other communication parameters to devices connected to the network using a client–server architecture (from wiki )
client-server architecture? In a home network, router is the server and client is my PCs, laptops, Raspberry Pis etc.
T i l
Embedded field in Go
Initializing embedded field: The field name of an anonymous field during a struct instantiation is the name of the struct (Time) type Event struct { ID int time.Time } event := Event{ ID: 1234, Time: time.Now(), } If an embedded field type implements an interface, the struct containing the embedded field will also implement this interface
T i l
IPs
In v6, /48 is the minimum prefix that can be advertised by the routers in the Internet.
I believe in v4, its /24.
Until yesterday I wasn’t aware of that. I might have thought you could even advertise one IP (ie. /128 or /32) but that’s not possible.
Ref: https://blog.apnic.net/2020/06/01/why-is-a-48-the-recommended-minimum-prefix-size-for-routing
T i l
all goroutines are asleep - deadlock!
program1
package main import ( "log" ) func main() { done := make(chan struct{}) go func() { log.Println("done") }() <-done //wait for background goroutine to finish } program2 run nc -l 8000 on another terminal
package main import ( "log" "net" ) func main() { conn, err := net.Dial("tcp", "localhost:8000") if err != nil { log.Fatal(err) } conn.Close() done := make(chan struct{}) go func() { log.Println("done") }() <-done //wait for background goroutine to finish } Both of those examples have a receive statement from a channel that no one ever sends to.
T i l
namespaces
namespaces is a Linux Kernel feature. There are different types of namespaces - Partitions Kernel resources such that one set of Processes see a different resources while others different - Apartment complex analogy - 7 different namespaces - PID namespace - Watching TV show - Net namespace - each namespace gets an unique IP address s list of port. - apartment address analogy - Uts namespace - host names for Ip address - Telling taxi driver apartment name instead of address - User namespace - Files are associated with VID Euser Identification - Mailbox associated to apartment unit # not with the name of the person - Mit namespace o to isolate mount points such that processes in different namespaces cannot view each others files.