initial: ZeroTier-like P2P mesh VPN server with multi-tenant Web UI

This commit is contained in:
xieyao
2026-06-17 03:50:23 +08:00
commit ee5f036325
74 changed files with 9517 additions and 0 deletions

24
internal/tap/tap.go Normal file
View File

@@ -0,0 +1,24 @@
package tap
type Interface struct {
Name string
MTU int
fd int
}
// Open creates a TAP interface on Linux. On other platforms it returns an error.
func Open(name string, mtu int) (*Interface, error) {
return openTap(name, mtu)
}
func (t *Interface) Read(buf []byte) (int, error) {
return readBuf(t.fd, buf)
}
func (t *Interface) Write(buf []byte) (int, error) {
return writeBuf(t.fd, buf)
}
func (t *Interface) Close() error {
return closeFD(t.fd)
}