-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
1 parent
58fbc12
commit 47752e1
Showing
9 changed files
with
185 additions
and
26 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
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
2 changes: 1 addition & 1 deletion
2
...outemanager/systemops/systemops_mobile.go → ...utemanager/systemops/systemops_android.go
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,4 +1,4 @@ | ||
//go:build ios || android | ||
//go:build android | ||
|
||
package systemops | ||
|
||
|
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
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,64 @@ | ||
//go:build ios | ||
|
||
package systemops | ||
|
||
import ( | ||
"net" | ||
"net/netip" | ||
"runtime" | ||
|
||
log "github.com/sirupsen/logrus" | ||
|
||
nbnet "github.com/netbirdio/netbird/util/net" | ||
) | ||
|
||
func (r *SysOps) SetupRouting([]net.IP) (nbnet.AddHookFunc, nbnet.RemoveHookFunc, error) { | ||
r.mu.Lock() | ||
defer r.mu.Unlock() | ||
r.prefixes = make(map[netip.Prefix]struct{}) | ||
return nil, nil, nil | ||
} | ||
|
||
func (r *SysOps) CleanupRouting() error { | ||
r.mu.Lock() | ||
defer r.mu.Unlock() | ||
|
||
r.prefixes = make(map[netip.Prefix]struct{}) | ||
r.notify() | ||
return nil | ||
} | ||
|
||
func (r *SysOps) AddVPNRoute(prefix netip.Prefix, _ *net.Interface) error { | ||
r.mu.Lock() | ||
defer r.mu.Unlock() | ||
|
||
r.prefixes[prefix] = struct{}{} | ||
r.notify() | ||
return nil | ||
} | ||
|
||
func (r *SysOps) RemoveVPNRoute(prefix netip.Prefix, _ *net.Interface) error { | ||
r.mu.Lock() | ||
defer r.mu.Unlock() | ||
|
||
delete(r.prefixes, prefix) | ||
r.notify() | ||
return nil | ||
} | ||
|
||
func EnableIPForwarding() error { | ||
log.Infof("Enable IP forwarding is not implemented on %s", runtime.GOOS) | ||
return nil | ||
} | ||
|
||
func IsAddrRouted(netip.Addr, []netip.Prefix) (bool, netip.Prefix) { | ||
return false, netip.Prefix{} | ||
} | ||
|
||
func (r *SysOps) notify() { | ||
prefixes := make([]netip.Prefix, 0, len(r.prefixes)) | ||
for prefix := range r.prefixes { | ||
prefixes = append(prefixes, prefix) | ||
} | ||
r.notifier.OnNewPrefixes(prefixes) | ||
} |
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
Oops, something went wrong.