1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00
wireguard-go/src/main.go

44 lines
577 B
Go
Raw Normal View History

package main
2017-06-26 13:14:02 +02:00
import (
"log"
"net"
2017-06-26 13:14:02 +02:00
)
/*
*
* TODO: Fix logging
*/
func main() {
// Open TUN device
// TODO: Fix capabilities
tun, err := CreateTUN("test0")
log.Println(tun, err)
if err != nil {
return
}
device := NewDevice(tun)
// Start configuration lister
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)
}
go func(conn net.Conn) {
err := ipcListen(device, conn)
log.Println(err)
}(fd)
}
}