summaryrefslogtreecommitdiffhomepage
path: root/src/main.go
blob: 0f5016df9e7110dfbeba75b85cebf06cc24e60d9 (plain)
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
27
28
package main

import (
	"fmt"
	"log"
	"net"
)

func main() {
	l, err := net.Listen("unix", "/var/run/wireguard/wg0.sock")
	if err != nil {
		log.Fatal("listen error:", err)
	}

	for {
		fd, err := l.Accept()
		if err != nil {
			log.Fatal("accept error:", err)
		}

		var dev Device
		go func(conn net.Conn) {
			err := ipcListen(&dev, conn)
			fmt.Println(err)
		}(fd)
	}

}