about summary refs log tree commit diff
path: root/fun/tvl-ebooks/make-v6/main.go
blob: 6d4d0047bbac74b9ab337b7b930628a03efb7d08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
	//
}