/*
GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2017 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
"io"
)
+// TAP is a TUN or a TAP interface.
type TAP struct {
Name string
Sink chan []byte
taps = make(map[string]*TAP)
)
+// NewTAP create a new TUN/TAP virtual interface
func NewTAP(ifaceName string, mtu int) (*TAP, error) {
tapRaw, err := newTAPer(ifaceName)
if err != nil {
return t.dev.Write(data)
}
+// TAPListen open an existing TAP, if none exists, open one
func TAPListen(ifaceName string, mtu int) (*TAP, error) {
tap, exists := taps[ifaceName]
if exists {