mirror of
https://github.com/fosrl/newt.git
synced 2026-02-23 21:36:37 +00:00
Holepunch to the right endpoint
This commit is contained in:
13
linux.go
13
linux.go
@@ -55,11 +55,20 @@ func closeClients() {
|
||||
}
|
||||
}
|
||||
|
||||
func clientsHandleNewtConnection(publicKey string) {
|
||||
func clientsHandleNewtConnection(publicKey string, endpoint string) {
|
||||
if wgService == nil {
|
||||
return
|
||||
}
|
||||
wgService.SetServerPubKey(publicKey)
|
||||
|
||||
// split off the port from the endpoint
|
||||
parts := strings.Split(endpoint, ":")
|
||||
if len(parts) < 2 {
|
||||
logger.Error("Invalid endpoint format: %s", endpoint)
|
||||
return
|
||||
}
|
||||
endpoint = strings.Join(parts[:len(parts)-1], ":")
|
||||
|
||||
wgService.StartHolepunch(publicKey, endpoint)
|
||||
}
|
||||
|
||||
func clientsOnConnect() {
|
||||
|
||||
Reference in New Issue
Block a user