Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
437 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
8.1.0 | ||
8.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
iptool: /sbin/ifconfig | ||
pmtu: false | ||
mtu: 1500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
iptool: /sbin/ip | ||
pmtu: false | ||
mtu: 1500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
iptool: netsh.exe | ||
taptool: C:\\Program Files\\TAP-Windows\\bin\\tapinstall.exe | ||
inf_file: C:\\Program Files\\TAP-Windows\\driver\\OemVista.inf | ||
pmtu: false | ||
mtu: 1500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package ptp | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
|
||
yaml "gopkg.in/yaml.v2" | ||
) | ||
|
||
type conf struct { | ||
IPTool string `yaml:"iptool"` | ||
TAPTool string `yaml:"taptool"` | ||
INFFile string `yaml:"inf_file"` | ||
MTU int `yaml:"mtu"` | ||
PMTU bool `yaml:"pmtu"` | ||
} | ||
|
||
func (c *conf) readConf(filepath string) error { | ||
yamlFile, err := ioutil.ReadFile(filepath) | ||
if err != nil { | ||
Log(Debug, "Failed to load config: %v", err) | ||
c.IPTool = DefaultIPTool | ||
c.TAPTool = DefaultTAPTool | ||
c.INFFile = DefaultINFFile | ||
c.MTU = DefaultMTU | ||
c.PMTU = DefaultPMTU | ||
return fmt.Errorf("Failed to load configuration file from %s: %s", filepath, err.Error()) | ||
} | ||
err = yaml.Unmarshal(yamlFile, c) | ||
if err != nil { | ||
return fmt.Errorf("Failed to parse config: %v", err) | ||
} | ||
return nil | ||
} | ||
|
||
func (c *conf) getIPTool(preset string) string { | ||
if preset != "" { | ||
return preset | ||
} | ||
return c.IPTool | ||
} | ||
|
||
func (c *conf) getTAPTool(preset string) string { | ||
if preset != "" { | ||
return preset | ||
} | ||
return c.TAPTool | ||
} | ||
|
||
func (c *conf) getINFFile(preset string) string { | ||
if preset != "" { | ||
return preset | ||
} | ||
return c.INFFile | ||
} | ||
|
||
func (c *conf) getMTU(preset int) int { | ||
if preset != 0 { | ||
return preset | ||
} | ||
return c.MTU | ||
} | ||
|
||
func (c *conf) getPMTU(preset bool) bool { | ||
if preset { | ||
return preset | ||
} | ||
return c.PMTU | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// +build darwin | ||
|
||
package ptp | ||
|
||
// Platform specific defaults | ||
const ( | ||
DefaultIPTool = "/sbin/ifconfig" // Default network interface configuration tool for Darwin OS | ||
DefaultTAPTool = "" // Default path to TAP configuration tool on Windows OS | ||
DefaultINFFile = "" // Default path to TAP INF file used by Windows OS | ||
DefaultMTU = 1500 // Default MTU value | ||
DefaultPMTU = false // Default PMTU switch | ||
) |
Oops, something went wrong.