celzero / firestack

Userspace wireguard and network monitor
https://rethinkdns.com/app
Mozilla Public License 2.0
100 stars 16 forks source link

Build an ios/macos xcframework #94

Open paillardf opened 2 months ago

paillardf commented 2 months ago

Hi, I'm trying to use the lib to build an iOS/MacOS NEPacketTunnelProvider to setup a local DNS filtering VPN. To do so it seems that I need to build a intra version of the lib but I don't manage to compile. The iOS side of the library doesn't seem to be maintain anymore but I would be glad to help as much as I can. I just need a bit of support to get started with it.

You will find attached the logs I have so far: trying to build it ```sh export MACOSX_DEPLOYMENT_TARGET=17.5; /Users/f.paillard/projects/firestack/bin/gomobile bind -v -a -x -iosversion=17.5 -target=ios,iossimulator,macos -o /Users/f.paillard/projects/firestack/build/apple-intra/Tun2socks.xcframework -ldflags '-s -w' -bundleid org.outline.tun2socks github.com/celzero/firestack/intra github.com/celzero/firestack/intra/backend github.com/celzero/firestack/intra/rnet github.com/celzero/firestack/intra/settings GOMOBILE=/Users/f.paillard/go/pkg/gomobile WORK=/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127 rm -r -f "/Users/f.paillard/projects/firestack/build/apple-intra/Tun2socks.xcframework" GOOS=ios CGO_ENABLED=1 $GOPATH/bin/gobind -lang=go,objc -outdir=$WORK/ios -tags=ios github.com/celzero/firestack/intra github.com/celzero/firestack/intra/backend github.com/celzero/firestack/intra/rnet github.com/celzero/firestack/intra/settings GOOS=darwin CGO_ENABLED=1 $GOPATH/bin/gobind -lang=go,objc -outdir=$WORK/macos -tags=macos github.com/celzero/firestack/intra github.com/celzero/firestack/intra/backend github.com/celzero/firestack/intra/rnet github.com/celzero/firestack/intra/settings GOOS=ios CGO_ENABLED=1 $GOPATH/bin/gobind -lang=go,objc -outdir=$WORK/iossimulator -tags=ios github.com/celzero/firestack/intra github.com/celzero/firestack/intra/backend github.com/celzero/firestack/intra/rnet github.com/celzero/firestack/intra/settings write /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127/iossimulator/src-amd64/go.mod write /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127/iossimulator/src-arm64/go.mod write /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127/macos/src-arm64/go.mod write /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127/macos/src-amd64/go.mod write /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127/ios/src-arm64/go.mod mkdir -p $WORK/iossimulator/src-arm64 mkdir -p $WORK/iossimulator/src-amd64 mkdir -p $WORK/macos/src-arm64 mkdir -p $WORK/macos/src-amd64 mkdir -p $WORK/ios/src-arm64 PWD=$WORK/ios/src-arm64 GOMODCACHE=$GOPATH/pkg/mod GOOS=ios GOARCH=arm64 GOFLAGS=-tags=ios CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -miphoneos-version-min=17.5 -fembed-bitcode -arch arm64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -miphoneos-version-min=17.5 -fembed-bitcode -arch arm64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -miphoneos-version-min=17.5 -fembed-bitcode -arch arm64 CGO_ENABLED=1 DARWIN_SDK=iphoneos GOPATH=$WORK/ios:$GOPATH go mod tidy -v PWD=$WORK/macos/src-amd64 GOMODCACHE=$GOPATH/pkg/mod GOOS=darwin GOARCH=amd64 GOFLAGS=-tags=macos CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -arch x86_64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -arch x86_64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -arch x86_64 CGO_ENABLED=1 DARWIN_SDK=macosx GOPATH=$WORK/macos:$GOPATH go mod tidy -v PWD=$WORK/iossimulator/src-arm64 GOMODCACHE=$GOPATH/pkg/mod GOOS=ios GOARCH=arm64 GOFLAGS=-tags=ios CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch arm64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch arm64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch arm64 CGO_ENABLED=1 DARWIN_SDK=iphonesimulator GOPATH=$WORK/iossimulator:$GOPATH go mod tidy -v PWD=$WORK/macos/src-arm64 GOMODCACHE=$GOPATH/pkg/mod GOOS=darwin GOARCH=arm64 GOFLAGS=-tags=macos CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fembed-bitcode -arch arm64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fembed-bitcode -arch arm64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fembed-bitcode -arch arm64 CGO_ENABLED=1 DARWIN_SDK=macosx GOPATH=$WORK/macos:$GOPATH go mod tidy -v PWD=$WORK/iossimulator/src-amd64 GOMODCACHE=$GOPATH/pkg/mod GOOS=ios GOARCH=amd64 GOFLAGS=-tags=ios CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch x86_64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch x86_64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch x86_64 CGO_ENABLED=1 DARWIN_SDK=iphonesimulator GOPATH=$WORK/iossimulator:$GOPATH go mod tidy -v go: found github.com/celzero/firestack/intra in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/backend in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/rnet in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/settings in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/backend in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/rnet in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/settings in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/backend in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/rnet in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/settings in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 unused github.com/BurntSushi/toml unused github.com/Microsoft/go-winio unused github.com/Microsoft/hcsshim unused github.com/bazelbuild/rules_go unused github.com/bwesterb/go-ristretto unused github.com/cenkalti/backoff unused github.com/cilium/ebpf unused github.com/containerd/cgroups unused github.com/containerd/console unused github.com/containerd/containerd unused github.com/containerd/continuity unused github.com/containerd/fifo unused github.com/containerd/go-runc unused github.com/containerd/ttrpc unused github.com/containerd/typeurl unused github.com/coreos/go-systemd/v22 unused github.com/crazy-max/xgo unused github.com/davecgh/go-spew unused github.com/docker/go-units unused github.com/elazarl/goproxy/ext unused github.com/gin-contrib/sse unused github.com/gin-gonic/gin unused github.com/go-logr/logr unused github.com/go-playground/assert/v2 unused github.com/go-playground/locales unused github.com/go-playground/universal-translator unused github.com/go-playground/validator/v10 unused github.com/gobwas/httphead unused github.com/gobwas/pool unused github.com/gobwas/ws unused github.com/godbus/dbus/v5 unused github.com/gofrs/flock unused github.com/gogo/protobuf unused github.com/golang/groupcache unused github.com/golang/mock unused github.com/golang/protobuf unused github.com/google/go-cmp unused github.com/google/go-github/v56 unused github.com/google/gofuzz unused github.com/google/subcommands unused github.com/googleapis/gnostic unused github.com/gorilla/websocket unused github.com/hanwen/go-fuse/v2 unused github.com/hashicorp/errwrap unused github.com/hashicorp/go-multierror unused github.com/json-iterator/go unused github.com/kr/pty unused github.com/leodido/go-urn unused github.com/mattbaird/jsonpatch unused github.com/mattn/go-isatty unused github.com/modern-go/concurrent unused github.com/modern-go/reflect2 unused github.com/mohae/deepcopy unused github.com/opencontainers/go-digest unused github.com/opencontainers/runtime-spec unused github.com/pkg/errors unused github.com/pmezard/go-difflib unused github.com/rogpeppe/go-charset unused github.com/sirupsen/logrus unused github.com/stretchr/objx unused github.com/syndtr/gocapability unused github.com/ugorji/go unused github.com/ugorji/go/codec unused github.com/vishvananda/netlink unused github.com/vishvananda/netns unused github.com/yuin/goldmark unused go.opencensus.io unused golang.org/x/exp unused golang.org/x/exp/shiny unused golang.org/x/image unused golang.org/x/oauth2 unused golang.org/x/telemetry unused golang.org/x/term unused golang.org/x/xerrors unused google.golang.org/appengine unused google.golang.org/genproto unused google.golang.org/grpc unused google.golang.org/grpc/cmd/protoc-gen-go-grpc unused google.golang.org/protobuf unused gopkg.in/check.v1 unused gopkg.in/inf.v0 unused gopkg.in/tomb.v1 unused gopkg.in/yaml.v2 unused gopkg.in/yaml.v3 unused gotest.tools/v3 unused honnef.co/go/tools unused k8s.io/api unused k8s.io/apimachinery unused k8s.io/client-go unused k8s.io/klog/v2 unused k8s.io/kube-openapi unused k8s.io/utils unused sigs.k8s.io/json unused sigs.k8s.io/structured-merge-diff/v4 unused sigs.k8s.io/yaml go: found github.com/celzero/firestack/intra in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/backend in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/rnet in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/settings in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/backend in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/rnet in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 go: found github.com/celzero/firestack/intra/settings in github.com/celzero/firestack v0.0.0-00010101000000-000000000000 PWD=$WORK/ios/src-arm64 GOMODCACHE=$GOPATH/pkg/mod GOOS=ios GOARCH=arm64 GOFLAGS=-tags=ios CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -miphoneos-version-min=17.5 -fembed-bitcode -arch arm64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -miphoneos-version-min=17.5 -fembed-bitcode -arch arm64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -miphoneos-version-min=17.5 -fembed-bitcode -arch arm64 CGO_ENABLED=1 DARWIN_SDK=iphoneos GOPATH=$WORK/ios:$GOPATH go build -v -x -ldflags -s -w -buildmode=c-archive -o $WORK/Tun2socks-ios-arm64.a ./gobind unused github.com/BurntSushi/toml unused github.com/Microsoft/go-winio unused github.com/Microsoft/hcsshim unused github.com/bazelbuild/rules_go unused github.com/bwesterb/go-ristretto unused github.com/cenkalti/backoff unused github.com/cilium/ebpf unused github.com/containerd/cgroups unused github.com/containerd/console unused github.com/containerd/containerd unused github.com/containerd/continuity unused github.com/containerd/fifo unused github.com/containerd/go-runc unused github.com/containerd/ttrpc unused github.com/containerd/typeurl unused github.com/coreos/go-systemd/v22 unused github.com/crazy-max/xgo unused github.com/davecgh/go-spew unused github.com/docker/go-units unused github.com/elazarl/goproxy/ext unused github.com/gin-contrib/sse unused github.com/gin-gonic/gin unused github.com/go-logr/logr unused github.com/go-playground/assert/v2 unused github.com/go-playground/locales unused github.com/go-playground/universal-translator unused github.com/go-playground/validator/v10 unused github.com/gobwas/httphead unused github.com/gobwas/pool unused github.com/gobwas/ws unused github.com/godbus/dbus/v5 unused github.com/gofrs/flock unused github.com/gogo/protobuf unused github.com/golang/groupcache unused github.com/golang/mock unused github.com/golang/protobuf unused github.com/google/go-cmp unused github.com/google/go-github/v56 unused github.com/google/gofuzz unused github.com/google/subcommands unused github.com/googleapis/gnostic unused github.com/gorilla/websocket unused github.com/hanwen/go-fuse/v2 unused github.com/hashicorp/errwrap unused github.com/hashicorp/go-multierror unused github.com/json-iterator/go unused github.com/kr/pty unused github.com/leodido/go-urn unused github.com/mattbaird/jsonpatch unused github.com/mattn/go-isatty unused github.com/modern-go/concurrent unused github.com/modern-go/reflect2 unused github.com/mohae/deepcopy unused github.com/opencontainers/go-digest unused github.com/opencontainers/runtime-spec unused github.com/pkg/errors unused github.com/pmezard/go-difflib unused github.com/rogpeppe/go-charset unused github.com/sirupsen/logrus unused github.com/stretchr/objx unused github.com/syndtr/gocapability unused github.com/ugorji/go unused github.com/ugorji/go/codec unused github.com/vishvananda/netlink unused github.com/vishvananda/netns unused github.com/yuin/goldmark unused go.opencensus.io unused golang.org/x/exp unused golang.org/x/exp/shiny unused golang.org/x/image unused golang.org/x/oauth2 unused golang.org/x/telemetry unused golang.org/x/term unused golang.org/x/xerrors unused google.golang.org/appengine unused google.golang.org/genproto unused google.golang.org/grpc unused google.golang.org/grpc/cmd/protoc-gen-go-grpc unused google.golang.org/protobuf unused gopkg.in/check.v1 unused gopkg.in/inf.v0 unused gopkg.in/tomb.v1 unused gopkg.in/yaml.v2 unused gopkg.in/yaml.v3 unused gotest.tools/v3 unused honnef.co/go/tools unused k8s.io/api unused k8s.io/apimachinery unused k8s.io/client-go unused k8s.io/klog/v2 unused k8s.io/kube-openapi unused k8s.io/utils unused sigs.k8s.io/json unused sigs.k8s.io/structured-merge-diff/v4 unused sigs.k8s.io/yaml unused github.com/BurntSushi/toml unused github.com/Microsoft/go-winio unused github.com/Microsoft/hcsshim unused github.com/bazelbuild/rules_go unused github.com/bwesterb/go-ristretto unused github.com/cenkalti/backoff unused github.com/cilium/ebpf unused github.com/containerd/cgroups unused github.com/containerd/console unused github.com/containerd/containerd unused github.com/containerd/continuity unused github.com/containerd/fifo unused github.com/containerd/go-runc unused github.com/containerd/ttrpc unused github.com/containerd/typeurl unused github.com/coreos/go-systemd/v22 unused github.com/crazy-max/xgo unused github.com/davecgh/go-spew unused github.com/docker/go-units unused github.com/elazarl/goproxy/ext unused github.com/gin-contrib/sse unused github.com/gin-gonic/gin unused github.com/go-logr/logr unused github.com/go-playground/assert/v2 unused github.com/go-playground/locales unused github.com/go-playground/universal-translator unused github.com/go-playground/validator/v10 unused github.com/gobwas/httphead unused github.com/gobwas/pool unused github.com/gobwas/ws unused github.com/godbus/dbus/v5 unused github.com/gofrs/flock unused github.com/gogo/protobuf unused github.com/golang/groupcache unused github.com/golang/mock unused github.com/golang/protobuf unused github.com/google/go-cmp unused github.com/google/go-github/v56 unused github.com/google/gofuzz unused github.com/google/subcommands unused github.com/googleapis/gnostic unused github.com/gorilla/websocket unused github.com/hanwen/go-fuse/v2 unused github.com/hashicorp/errwrap unused github.com/hashicorp/go-multierror unused github.com/json-iterator/go unused github.com/kr/pty unused github.com/leodido/go-urn unused github.com/mattbaird/jsonpatch unused github.com/mattn/go-isatty unused github.com/modern-go/concurrent unused github.com/modern-go/reflect2 unused github.com/mohae/deepcopy unused github.com/opencontainers/go-digest unused github.com/opencontainers/runtime-spec unused github.com/pkg/errors unused github.com/pmezard/go-difflib unused github.com/rogpeppe/go-charset unused github.com/sirupsen/logrus unused github.com/stretchr/objx unused github.com/syndtr/gocapability unused github.com/ugorji/go unused github.com/ugorji/go/codec unused github.com/vishvananda/netlink unused github.com/vishvananda/netns unused github.com/yuin/goldmark unused go.opencensus.io unused golang.org/x/exp unused golang.org/x/exp/shiny unused golang.org/x/image unused golang.org/x/oauth2 unused golang.org/x/telemetry unused golang.org/x/term unused golang.org/x/xerrors unused google.golang.org/appengine unused google.golang.org/genproto unused google.golang.org/grpc unused google.golang.org/grpc/cmd/protoc-gen-go-grpc unused google.golang.org/protobuf unused gopkg.in/check.v1 unused gopkg.in/inf.v0 unused gopkg.in/tomb.v1 unused gopkg.in/yaml.v2 unused gopkg.in/yaml.v3 unused gotest.tools/v3 unused honnef.co/go/tools unused k8s.io/api unused k8s.io/apimachinery unused k8s.io/client-go unused k8s.io/klog/v2 unused k8s.io/kube-openapi unused k8s.io/utils unused sigs.k8s.io/json unused sigs.k8s.io/structured-merge-diff/v4 unused sigs.k8s.io/yaml WORK=/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/go-build2825726856 unused github.com/BurntSushi/toml unused github.com/Microsoft/go-winio unused github.com/Microsoft/hcsshim unused github.com/bazelbuild/rules_go unused github.com/bwesterb/go-ristretto unused github.com/cenkalti/backoff unused github.com/cilium/ebpf unused github.com/containerd/cgroups unused github.com/containerd/console unused github.com/containerd/containerd unused github.com/containerd/continuity unused github.com/containerd/fifo unused github.com/containerd/go-runc unused github.com/containerd/ttrpc unused github.com/containerd/typeurl unused github.com/coreos/go-systemd/v22 unused github.com/crazy-max/xgo unused github.com/davecgh/go-spew unused github.com/docker/go-units unused github.com/elazarl/goproxy/ext unused github.com/gin-contrib/sse unused github.com/gin-gonic/gin unused github.com/go-logr/logr unused github.com/go-playground/assert/v2 unused github.com/go-playground/locales unused github.com/go-playground/universal-translator unused github.com/go-playground/validator/v10 unused github.com/gobwas/httphead unused github.com/gobwas/pool unused github.com/gobwas/ws unused github.com/godbus/dbus/v5 unused github.com/gofrs/flock unused github.com/gogo/protobuf unused github.com/golang/groupcache unused github.com/golang/mock unused github.com/golang/protobuf unused github.com/google/go-cmp unused github.com/google/go-github/v56 unused github.com/google/gofuzz unused github.com/google/subcommands unused github.com/googleapis/gnostic unused github.com/gorilla/websocket unused github.com/hanwen/go-fuse/v2 unused github.com/hashicorp/errwrap unused github.com/hashicorp/go-multierror unused github.com/json-iterator/go unused github.com/kr/pty unused github.com/leodido/go-urn unused github.com/mattbaird/jsonpatch unused github.com/mattn/go-isatty unused github.com/modern-go/concurrent unused github.com/modern-go/reflect2 unused github.com/mohae/deepcopy unused github.com/opencontainers/go-digest unused github.com/opencontainers/runtime-spec unused github.com/pkg/errors unused github.com/pmezard/go-difflib unused github.com/rogpeppe/go-charset unused github.com/sirupsen/logrus unused github.com/stretchr/objx unused github.com/syndtr/gocapability unused github.com/ugorji/go unused github.com/ugorji/go/codec unused github.com/vishvananda/netlink unused github.com/vishvananda/netns unused github.com/yuin/goldmark unused go.opencensus.io unused golang.org/x/exp unused golang.org/x/exp/shiny unused golang.org/x/image unused golang.org/x/oauth2 unused golang.org/x/telemetry unused golang.org/x/term unused golang.org/x/xerrors unused google.golang.org/appengine unused google.golang.org/genproto unused google.golang.org/grpc unused google.golang.org/grpc/cmd/protoc-gen-go-grpc unused google.golang.org/protobuf unused gopkg.in/check.v1 unused gopkg.in/inf.v0 unused gopkg.in/tomb.v1 unused gopkg.in/yaml.v2 unused gopkg.in/yaml.v3 unused gotest.tools/v3 unused honnef.co/go/tools unused k8s.io/api unused k8s.io/apimachinery unused k8s.io/client-go unused k8s.io/klog/v2 unused k8s.io/kube-openapi unused k8s.io/utils unused sigs.k8s.io/json unused sigs.k8s.io/structured-merge-diff/v4 unused sigs.k8s.io/yaml unused github.com/BurntSushi/toml unused github.com/Microsoft/go-winio unused github.com/Microsoft/hcsshim unused github.com/bazelbuild/rules_go unused github.com/bwesterb/go-ristretto unused github.com/cenkalti/backoff unused github.com/cilium/ebpf unused github.com/containerd/cgroups unused github.com/containerd/console unused github.com/containerd/containerd unused github.com/containerd/continuity unused github.com/containerd/fifo unused github.com/containerd/go-runc unused github.com/containerd/ttrpc unused github.com/containerd/typeurl unused github.com/coreos/go-systemd/v22 unused github.com/crazy-max/xgo unused github.com/davecgh/go-spew unused github.com/docker/go-units unused github.com/elazarl/goproxy/ext unused github.com/gin-contrib/sse unused github.com/gin-gonic/gin unused github.com/go-logr/logr unused github.com/go-playground/assert/v2 unused github.com/go-playground/locales unused github.com/go-playground/universal-translator unused github.com/go-playground/validator/v10 unused github.com/gobwas/httphead unused github.com/gobwas/pool unused github.com/gobwas/ws unused github.com/godbus/dbus/v5 unused github.com/gofrs/flock unused github.com/gogo/protobuf unused github.com/golang/groupcache unused github.com/golang/mock unused github.com/golang/protobuf unused github.com/google/go-cmp unused github.com/google/go-github/v56 unused github.com/google/gofuzz unused github.com/google/subcommands unused github.com/googleapis/gnostic unused github.com/gorilla/websocket unused github.com/hanwen/go-fuse/v2 unused github.com/hashicorp/errwrap unused github.com/hashicorp/go-multierror unused github.com/json-iterator/go unused github.com/kr/pty unused github.com/leodido/go-urn unused github.com/mattbaird/jsonpatch unused github.com/mattn/go-isatty unused github.com/modern-go/concurrent unused github.com/modern-go/reflect2 unused github.com/mohae/deepcopy unused github.com/opencontainers/go-digest unused github.com/opencontainers/runtime-spec unused github.com/pkg/errors unused github.com/pmezard/go-difflib unused github.com/rogpeppe/go-charset unused github.com/sirupsen/logrus unused github.com/stretchr/objx unused github.com/syndtr/gocapability unused github.com/ugorji/go unused github.com/ugorji/go/codec unused github.com/vishvananda/netlink unused github.com/vishvananda/netns unused github.com/yuin/goldmark unused go.opencensus.io unused golang.org/x/exp unused golang.org/x/exp/shiny unused golang.org/x/image unused golang.org/x/oauth2 unused golang.org/x/telemetry unused golang.org/x/term unused golang.org/x/xerrors unused google.golang.org/appengine unused google.golang.org/genproto unused google.golang.org/grpc unused google.golang.org/grpc/cmd/protoc-gen-go-grpc unused google.golang.org/protobuf unused gopkg.in/check.v1 unused gopkg.in/inf.v0 unused gopkg.in/tomb.v1 unused gopkg.in/yaml.v2 unused gopkg.in/yaml.v3 unused gotest.tools/v3 unused honnef.co/go/tools unused k8s.io/api unused k8s.io/apimachinery unused k8s.io/client-go unused k8s.io/klog/v2 unused k8s.io/kube-openapi unused k8s.io/utils unused sigs.k8s.io/json unused sigs.k8s.io/structured-merge-diff/v4 unused sigs.k8s.io/yaml PWD=$WORK/iossimulator/src-arm64 GOMODCACHE=$GOPATH/pkg/mod GOOS=ios GOARCH=arm64 GOFLAGS=-tags=ios CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch arm64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch arm64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch arm64 CGO_ENABLED=1 DARWIN_SDK=iphonesimulator GOPATH=$WORK/iossimulator:$GOPATH go build -v -x -ldflags -s -w -buildmode=c-archive -o $WORK/Tun2socks-iossimulator-arm64.a ./gobind PWD=$WORK/macos/src-amd64 GOMODCACHE=$GOPATH/pkg/mod GOOS=darwin GOARCH=amd64 GOFLAGS=-tags=macos CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -arch x86_64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -arch x86_64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -arch x86_64 CGO_ENABLED=1 DARWIN_SDK=macosx GOPATH=$WORK/macos:$GOPATH go build -v -x -ldflags -s -w -buildmode=c-archive -o $WORK/Tun2socks-macos-amd64.a ./gobind PWD=$WORK/macos/src-arm64 GOMODCACHE=$GOPATH/pkg/mod GOOS=darwin GOARCH=arm64 GOFLAGS=-tags=macos CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fembed-bitcode -arch arm64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fembed-bitcode -arch arm64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -fembed-bitcode -arch arm64 CGO_ENABLED=1 DARWIN_SDK=macosx GOPATH=$WORK/macos:$GOPATH go build -v -x -ldflags -s -w -buildmode=c-archive -o $WORK/Tun2socks-macos-arm64.a ./gobind WORK=/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/go-build1656248372 WORK=/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/go-build1211971048 WORK=/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/go-build4247264775 PWD=$WORK/iossimulator/src-amd64 GOMODCACHE=$GOPATH/pkg/mod GOOS=ios GOARCH=amd64 GOFLAGS=-tags=ios CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CGO_CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch x86_64 CGO_CXXFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch x86_64 CGO_LDFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -mios-simulator-version-min=17.5 -fembed-bitcode -arch x86_64 CGO_ENABLED=1 DARWIN_SDK=iphonesimulator GOPATH=$WORK/iossimulator:$GOPATH go build -v -x -ldflags -s -w -buildmode=c-archive -o $WORK/Tun2socks-iossimulator-amd64.a ./gobind WORK=/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/go-build878563695 package gobind/gobind imports github.com/celzero/firestack/intra imports github.com/celzero/firestack/intra/dns53 imports github.com/celzero/firestack/intra/ipn imports github.com/celzero/firestack/intra/netstack imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in /Users/f.paillard/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240729225701-924c9908865c/pkg/rawfile package gobind/gobind imports github.com/celzero/firestack/intra imports github.com/celzero/firestack/intra/dns53 imports github.com/celzero/firestack/intra/ipn imports github.com/celzero/firestack/intra/netstack imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in /Users/f.paillard/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240729225701-924c9908865c/pkg/rawfile package gobind/gobind imports github.com/celzero/firestack/intra imports github.com/celzero/firestack/intra/dns53 imports github.com/celzero/firestack/intra/ipn imports github.com/celzero/firestack/intra/netstack imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in /Users/f.paillard/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240729225701-924c9908865c/pkg/rawfile package gobind/gobind imports github.com/celzero/firestack/intra imports github.com/celzero/firestack/intra/dns53 imports github.com/celzero/firestack/intra/ipn imports github.com/celzero/firestack/intra/netstack imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in /Users/f.paillard/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240729225701-924c9908865c/pkg/rawfile package gobind/gobind imports github.com/celzero/firestack/intra imports github.com/celzero/firestack/intra/dns53 imports github.com/celzero/firestack/intra/ipn imports github.com/celzero/firestack/intra/netstack imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in /Users/f.paillard/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240729225701-924c9908865c/pkg/rawfile rm -r -f "$WORK" /Users/f.paillard/projects/firestack/bin/gomobile: ios/arm64: go build -v -x -ldflags -s -w -buildmode=c-archive -o /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-154784127/Tun2socks-ios-arm64.a ./gobind failed: exit status 1 make: *** [/Users/f.paillard/projects/firestack/build/apple-intra/Tun2socks.xcframework] Error 1 ```

Thanks for the support

ignoramous commented 2 months ago

See if it builds (or ends up at a different error) after go get gvisor.dev/gvisor@go?

Unfortunately, we don't have Mac to test building for Apple platforms.

I'm trying to use the lib to build an iOS/MacOS NEPacketTunnelProvider to setup a local DNS filtering VPN.

A word of caution: Firestack has been built with Android in mind, and so you may find adopting to iOS / macOS APIs very frustrating.

paillardf commented 2 months ago

Same result with go get gvisor.dev/gvisor@go but I tried to update gvisor to the latest version in go.mod and I now have

/var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-1330880706/ios/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240917001129-4bcbb55fcba5/pkg/tcpip/adapters/gonet/gonet.go:29:2: found packages stack (addressable_endpoint_state.go) and bridge (bridge_test.go) in /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-1330880706/ios/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240917001129-4bcbb55fcba5/pkg/tcpip/stack
package gobind/gobind
    imports github.com/celzero/firestack/intra
    imports github.com/celzero/firestack/intra/dns53
    imports github.com/celzero/firestack/intra/ipn
    imports github.com/celzero/firestack/intra/netstack
    imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-1330880706/ios/pkg/mod/gvisor.dev/gvisor@v0.0.0-20240917001129-4bcbb55fcba5/pkg/rawfile
rm -r -f "$WORK"
/Users/f.paillard/projects/eyeo/firestack/bin/gomobile: ios/arm64: go build -v -x -ldflags -s -w -buildmode=c-archive -o /var/folders/7t/w6vzvhfx2t78f9lpkdx8xp440000gq/T/gomobile-work-1330880706/Tun2socks-ios-arm64.a ./gobind failed: exit status 1
ignoramous commented 2 months ago

The Makefile needs to account for newer API additions, I guess.

Android exports pkgs (from import paths) that iOS doesn't: https://github.com/celzero/firestack/blob/b90c0dc46889898b05f91ff5d8f755c5845d63a4/Makefile#L23

iOS: https://github.com/celzero/firestack/blob/b90c0dc46889898b05f91ff5d8f755c5845d63a4/Makefile#L47

paillardf commented 2 months ago

The packet you are using gvisor.dev/gvisor doesn't seem compatible with macos/ios. The build flag in gvisor.dev/gvisor/pkg/rawfile only target linux arm64 and amd64 arch.

ignoramous commented 2 months ago

Unsure about iOS but various projects do have gvisor/netstack running on macOS: