Possible to reuse std/net logic for a Tun device?

63 views
Skip to first unread message

hey...@gmail.com

unread,
Jan 18, 2022, 10:21:53 AM1/18/22
to golang-nuts
Hi,

I'm trying to write a Tun device for linux. I learned a lot from github.com/songgao/water and wireguard-go on how to create a tun interface.

However, I'm not sure how to leverage std/net to read from and write to it. water seems to leave the read & write part to its users, and wireguard-go seems to parse/generate packets by its own logic.

I wonder if given a linux fd, is it possible to leverage std/net to read from and write to the corresponding Tun device?

Regards,
Glen
Reply all
Reply to author
Forward
0 new messages