Compare commits

...

17 Commits

Author SHA1 Message Date
Ian VanSchooten 5efaa3e177
Merge 71e6734865 into 43fad65cf7 2024-10-16 22:02:30 +00:00
John Maguire 43fad65cf7
Use correct relay key in Nebula config (#184) 2024-10-16 17:13:44 -04:00
John Maguire 470578865b
Update to support netip use in Nebula 1.9.4 (#182) 2024-10-16 17:02:28 -04:00
Ian VanSchooten 71e6734865 Remove checkBuild lane 2024-10-16 09:02:50 -04:00
Ian VanSchooten 5c0f98ad8a Just manually xcodebuild 2024-10-16 09:02:50 -04:00
Ian VanSchooten a88c845850 Remove setup_ci 2024-10-16 09:02:50 -04:00
Ian VanSchooten b82ef08fd1 Skip signing 2024-10-16 09:02:50 -04:00
Ian VanSchooten 0e9dae0a9c Build ios debug app, do not sign 2024-10-16 09:02:50 -04:00
Ian VanSchooten 9d5cda7810 Fix rebase error 2024-10-16 09:02:50 -04:00
Ian VanSchooten c886cfcf5b Rename workflow 2024-10-16 09:02:50 -04:00
Ian VanSchooten 8111303d91 Avoid incrementing version number 2024-10-16 09:02:50 -04:00
Ian VanSchooten da64471751 Use fastlane to build 2024-10-16 09:02:50 -04:00
Ian VanSchooten 3e58c41a0e Add fastlane match token 2024-10-16 09:02:50 -04:00
Ian VanSchooten a4703d1403 Add ios build step to ci 2024-10-16 09:02:50 -04:00
Ian VanSchooten 3cb7d84a7b Specify androidapi for gomobile 2024-10-16 09:02:50 -04:00
Ian VanSchooten c91f622e4e Add build workflow 2024-10-16 09:02:50 -04:00
Ian VanSchooten b8bcf32af4 Simplify/fix dart formatting in CI 2024-10-16 09:02:50 -04:00
8 changed files with 122 additions and 21 deletions

74
.github/workflows/smoke.yml vendored Normal file
View File

@ -0,0 +1,74 @@
# This workflow builds the iOS and Android apps, just to check they build without error
name: Smoke build
on:
push:
branches:
- main
pull_request:
jobs:
build-android:
name: Android
runs-on: macos-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.22"
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
- name: Check out code
uses: actions/checkout@v3
- name: install dependencies
env:
TOKEN: ${{ secrets.MACHINE_USER_PAT }}
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
- name: Build Android debug
run: flutter build appbundle --debug
build-ios:
name: iOS
runs-on: macos-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Install flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.1'
- name: Check out code
uses: actions/checkout@v3
- name: install dependencies
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
flutter pub get
touch env.sh
- name: Build iOS
run: |
cd ios
pod install
xcodebuild -workspace Runner.xcworkspace -scheme Runner -configuration Release clean archive CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -archivePath "build/MobileNebula.xcarchive"

View File

@ -21,7 +21,7 @@ class HostInfo {
factory HostInfo.fromJson(Map<String, dynamic> json) {
UDPAddress? currentRemote;
if (json['currentRemote'] != null) {
if (json['currentRemote'] != "") {
currentRemote = UDPAddress.fromJson(json['currentRemote']);
}
@ -52,6 +52,11 @@ class UDPAddress {
String ip;
int port;
UDPAddress({
required this.ip,
required this.port,
});
@override
String toString() {
// Simple check on if nebula told us about a v4 or v6 ip address
@ -62,7 +67,17 @@ class UDPAddress {
return '$ip:$port';
}
UDPAddress.fromJson(Map<String, dynamic> json)
: ip = json['ip'],
port = json['port'];
factory UDPAddress.fromJson(String json) {
// IPv4 Address
if (json.contains('.')) {
var ip = json.split(':')[0];
var port = int.parse(json.split(':')[1]);
return UDPAddress(ip: ip, port: port);
}
// IPv6 Address
var ip = json.split(']')[0].substring(1);
var port = int.parse(json.split(']')[1].split(':')[1]);
return UDPAddress(ip: ip, port: port);
}
}

View File

@ -9,7 +9,7 @@ clean:
mobileNebula.aar: *.go go.sum
go get -d golang.org/x/mobile/cmd/gomobile
gomobile bind -trimpath -v --target=android -androidapi 26
gomobile bind -trimpath -v --target=android -androidapi=26
MobileNebula.xcframework: *.go go.sum
go get -d golang.org/x/mobile/cmd/gomobile

View File

@ -14,7 +14,7 @@ type config struct {
Stats configStats `yaml:"stats"`
Handshakes configHandshakes `yaml:"handshakes"`
Firewall configFirewall `yaml:"firewall"`
Relays configRelays `yaml:"relays"`
Relay configRelay `yaml:"relay"`
}
func newConfig() *config {
@ -38,7 +38,7 @@ func newConfig() *config {
Punch: true,
Delay: "1s",
},
Relays: configRelays{
Relay: configRelay{
UseRelays: true,
},
Cipher: "aes",
@ -205,7 +205,7 @@ type configFirewallRule struct {
CAName string `yaml:"ca_name,omitempty"`
}
type configRelays struct {
type configRelay struct {
AmRelay bool `yaml:"am_relay,omitempty"`
UseRelays bool `yaml:"use_relays"`
relays []string `yaml:"relays,omitempty"`

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"net"
"net/netip"
"os"
"runtime"
"runtime/debug"
@ -12,9 +12,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/slackhq/nebula"
nc "github.com/slackhq/nebula/config"
"github.com/slackhq/nebula/iputil"
"github.com/slackhq/nebula/overlay"
"github.com/slackhq/nebula/udp"
"github.com/slackhq/nebula/util"
)
@ -109,7 +107,12 @@ func (n *Nebula) ListHostmap(pending bool) (string, error) {
}
func (n *Nebula) GetHostInfoByVpnIp(vpnIp string, pending bool) (string, error) {
b, err := json.Marshal(n.c.GetHostInfoByVpnIp(stringIpToInt(vpnIp), pending))
netVpnIp, err := netip.ParseAddr(vpnIp)
if err != nil {
return "", err
}
b, err := json.Marshal(n.c.GetHostInfoByVpnIp(netVpnIp, pending))
if err != nil {
return "", err
}
@ -118,16 +121,26 @@ func (n *Nebula) GetHostInfoByVpnIp(vpnIp string, pending bool) (string, error)
}
func (n *Nebula) CloseTunnel(vpnIp string) bool {
return n.c.CloseTunnel(stringIpToInt(vpnIp), false)
netVpnIp, err := netip.ParseAddr(vpnIp)
if err != nil {
return false
}
return n.c.CloseTunnel(netVpnIp, false)
}
func (n *Nebula) SetRemoteForTunnel(vpnIp string, addr string) (string, error) {
udpAddr := udp.NewAddrFromString(addr)
if udpAddr == nil {
udpAddr, err := netip.ParseAddrPort(addr)
if err != nil {
return "", errors.New("could not parse udp address")
}
b, err := json.Marshal(n.c.SetRemoteForTunnel(stringIpToInt(vpnIp), *udpAddr))
netVpnIp, err := netip.ParseAddr(vpnIp)
if err != nil {
return "", errors.New("could not parse vpnIp")
}
b, err := json.Marshal(n.c.SetRemoteForTunnel(netVpnIp, udpAddr))
if err != nil {
return "", err
}
@ -140,7 +153,3 @@ func (n *Nebula) Sleep() {
n.l.WithField("tunnels", closed).Info("Sleep called, closed non lighthouse tunnels")
}
}
func stringIpToInt(ip string) iputil.VpnIp {
return iputil.Ip2VpnIp(net.ParseIP(ip))
}

View File

@ -39,6 +39,7 @@ require (
github.com/vishvananda/netlink v1.3.0 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/mobile v0.0.0-20241016134751-7ff83004ec2c // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect

View File

@ -159,6 +159,8 @@ golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20241016134751-7ff83004ec2c h1:zuNS/LWsEpPTLfrmBkis6Xofw3nieAqB4hYLn8+uswk=
golang.org/x/mobile v0.0.0-20241016134751-7ff83004ec2c/go.mod h1:snk1Mn2ZpdKCt90JPEsDh4sL3ReK520U2t0d7RHBnSU=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=