about summary refs log tree commit diff
path: root/fun/tvl-ebooks/make-v6/main.go
diff options
context:
space:
mode:
authorBen Cartwright-Cox <tvl@Benjojo.co.uk>2020-09-27T23·22+0100
committerben <tvl@benjojo.co.uk>2020-09-27T23·26+0000
commita8508373ee4bb00d866315a63dccfaa924a8a6ae (patch)
treea2666ffa11767a5a510a5e8e6021db916c0620e6 /fun/tvl-ebooks/make-v6/main.go
parentcf878224ab60ef58fcb3cb0a52c7142bbe2ae10b (diff)
feat(ebooks): Add tvl-ebooks code r/1822
Change-Id: If519e789a91fbf427373daa383c6ae00ba5e0b6c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2007
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'fun/tvl-ebooks/make-v6/main.go')
-rw-r--r--fun/tvl-ebooks/make-v6/main.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/fun/tvl-ebooks/make-v6/main.go b/fun/tvl-ebooks/make-v6/main.go
new file mode 100644
index 0000000000..6d4d0047bb
--- /dev/null
+++ b/fun/tvl-ebooks/make-v6/main.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+	"crypto/rand"
+	"log"
+	"net"
+)
+
+func main() {
+	// 2a0c:2f07:29:9999:6564:5298:8413:4652
+	ip := net.ParseIP("2a0c:2f07:29::")
+
+	rand.Read(ip[6:])
+
+	if ip[7] > 0xaa {
+		ip[4] = 0x03
+		ip[5] = 0x84
+		if ip[7] > 0xdd {
+			ip[4] = 0x08
+			ip[5] = 0x64
+		}
+	}
+
+	log.Printf("%s\n", ip)
+	//
+}