feat: add interface black list to avoid undesired interfaces

This commit is contained in:
braginini
2021-05-16 18:05:08 +02:00
parent 47933bcbfa
commit a773ec8150
4 changed files with 37 additions and 18 deletions

View File

@@ -14,9 +14,10 @@ type Config struct {
Peers []connection.Peer
StunTurnURLs []*ice.URL
// host:port of the signal server
SignalAddr string
WgAddr string
WgIface string
SignalAddr string
WgAddr string
WgIface string
IFaceBlackList []string
}
//Write writes configPath to a file

View File

@@ -38,7 +38,11 @@ var (
//todo proper close handling
defer func() { signalClient.Close() }()
engine := connection.NewEngine(signalClient, config.StunTurnURLs, config.WgIface, config.WgAddr)
iFaceBlackList := make(map[string]struct{})
for i := 0; i < len(config.IFaceBlackList); i += 2 {
iFaceBlackList[config.IFaceBlackList[i]] = struct{}{}
}
engine := connection.NewEngine(signalClient, config.StunTurnURLs, config.WgIface, config.WgAddr, iFaceBlackList)
err = engine.Start(myKey, config.Peers)