add configurable punching delay because of race-condition-y conntracks (#210)

* add configurable punching delay because of race-condition-y conntracks

* add changelog

* fix tests

* only do one punch per query

* Coalesce punchy config

* It is not is not set

* Add tests

Co-authored-by: Nate Brown <nbrown.us@gmail.com>
This commit is contained in:
Ryan Huber
2020-03-27 11:26:39 -07:00
committed by GitHub
parent add1b21777
commit 1297090af3
9 changed files with 116 additions and 18 deletions

View File

@ -177,8 +177,8 @@ func Main(configPath string, configTest bool, buildVersion string) {
go hostMap.Promoter(config.GetInt("promoter.interval"))
*/
punchy := config.GetBool("punchy", false)
if punchy == true {
punchy := NewPunchyFromConfig(config)
if punchy.Punch {
l.Info("UDP hole punching enabled")
go hostMap.Punchy(udpServer)
}
@ -193,7 +193,6 @@ func Main(configPath string, configTest bool, buildVersion string) {
port = int(uPort.Port)
}
punchBack := config.GetBool("punch_back", false)
amLighthouse := config.GetBool("lighthouse.am_lighthouse", false)
// warn if am_lighthouse is enabled but upstream lighthouses exists
@ -222,7 +221,8 @@ func Main(configPath string, configTest bool, buildVersion string) {
config.GetInt("lighthouse.interval", 10),
port,
udpServer,
punchBack,
punchy.Respond,
punchy.Delay,
)
//TODO: Move all of this inside functions in lighthouse.go