Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is tun working on windows? #88

Open
tubzby opened this issue Apr 8, 2021 · 1 comment
Open

Is tun working on windows? #88

tubzby opened this issue Apr 8, 2021 · 1 comment

Comments

@tubzby
Copy link

tubzby commented Apr 8, 2021

I write a simple piece of test code on windows. after I startup the program, I set ip address of 10.8.0.6 , mask 255.255.0.0

Then I set a route via "route add 192.168.66.0 mask 255.255.255.0 10.8.0.6", then on a console I ping 192.168.66.1 to check if any packet is coming through the tun interface, but I don't see anything related to the ping command.

On the other hand, I used wireshark to capture all the request, seems that the operating system is sending ARP before sending the real traffic.

But, tun only support layer3, how to handle this situation?

test code:

func main() {
	tun, err := water.New(water.Config{
		DeviceType: water.TUN,
	})
	if err != nil {
		panic(err)
	}
	bs := make([]byte, 1500)

	i := 0
	log.SetLevel(log.DebugLevel)
	log.Infof("ready to start wireshark on: %s, isTap: %v", tun.Name(), tun.IsTAP())

	for {
		_, err := tun.Read(bs)
		if err != nil {
			log.Panic(err)
		}

		ver := (bs[0] & 0xf0) >> 4
		if ver == 4 {
			var header ipv4.Header
			header.Parse(bs)
			log.Infof("src:%s, dst:%s, protocol:%d", header.Src.String(), header.Dst.String(), header.Protocol)

		} else if ver == 6 {
			log.Infof("get ipv6 package")
		} else {
			log.Infof("unknown package")
		}

		i++
	}
}
@zliu13286
Copy link

I tried wireguard-go on windows: "https://git.zx2c4.com/wireguard-go/about/", it's working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants