mirror of
https://github.com/fosrl/newt.git
synced 2026-02-16 18:06:40 +00:00
Fix nil issues
This commit is contained in:
15
linux.go
15
linux.go
@@ -60,20 +60,23 @@ func closeClients() {
|
||||
}
|
||||
|
||||
func clientsHandleNewtConnection(publicKey string) {
|
||||
if wgService != nil {
|
||||
wgService.SetServerPubKey(publicKey)
|
||||
} else {
|
||||
logger.Error("WireGuard service is not initialized, cannot set server public key")
|
||||
if wgService == nil {
|
||||
return
|
||||
}
|
||||
wgService.SetServerPubKey(publicKey)
|
||||
}
|
||||
|
||||
func clientsOnConnect() {
|
||||
if wgService != nil {
|
||||
wgService.LoadRemoteConfig()
|
||||
if wgService == nil {
|
||||
return
|
||||
}
|
||||
wgService.LoadRemoteConfig()
|
||||
}
|
||||
|
||||
func clientsAddProxyTarget(pm *proxy.ProxyManager, tunnelIp string) {
|
||||
if wgService == nil {
|
||||
return
|
||||
}
|
||||
// add a udp proxy for localost and the wgService port
|
||||
// TODO: make sure this port is not used in a target
|
||||
pm.AddTarget("udp", tunnelIp, int(wgService.Port), fmt.Sprintf("127.0.0.1:%d", wgService.Port))
|
||||
|
||||
Reference in New Issue
Block a user