mirror of
https://github.com/fumiama/water.git
synced 2026-06-24 05:16:40 +08:00
Simplifies Platform Specific Interface Creation
The interface `Config` object is now passed directly into each creation function in order to more easily use additional options. In addition, the linux and darwin parameters were split to better capture different options for each platform.
This commit is contained in:
@@ -61,7 +61,7 @@ type sockaddrCtl struct {
|
||||
|
||||
var sockaddrCtlSize uintptr = 32
|
||||
|
||||
func newTUN(string) (ifce *Interface, err error) {
|
||||
func newTUN(config Config) (ifce *Interface, err error) {
|
||||
var fd int
|
||||
// Supposed to be socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL), but ...
|
||||
//
|
||||
@@ -122,6 +122,10 @@ func newTUN(string) (ifce *Interface, err error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func newTAP(config Config) (ifce *Interface, err error) {
|
||||
return nil, errors.New("tap interface not implemented on this platform")
|
||||
}
|
||||
|
||||
// tunReadCloser is a hack to work around the first 4 bytes "packet
|
||||
// information" because there doesn't seem to be an IFF_NO_PI for darwin.
|
||||
type tunReadCloser struct {
|
||||
@@ -189,7 +193,3 @@ func (t *tunReadCloser) Close() error {
|
||||
|
||||
return t.f.Close()
|
||||
}
|
||||
|
||||
func newTAP(ifName string) (ifce *Interface, err error) {
|
||||
return nil, errors.New("tap interface not implemented on this platform")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user