Skip to content

Commit

Permalink
Build patched Go runtime, recompile gomobile
Browse files Browse the repository at this point in the history
  • Loading branch information
alalamav committed Apr 15, 2019
1 parent 4d34590 commit a4465cf
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Go package for building [go-tun2socks](https://github.com/eycorsican/go-tun2sock

We use a custom Golang runtime to build the iOS and macOS framework built off Go 1.12. The [patch](https://go-review.googlesource.com/c/go/+/159117) improves memory reporting to the OS. This should not be necessary after Go 1.13 is released (scheduled for August 2019).

Additionally, Go 1.12 calls private APIs on Darwin, which is not approved for Mac App Store distribution. We have applied this [patch](https://go-review.googlesource.com/c/go/+/170640/), scheduled for release on Go 1.12.2.

You can use our pre-compiled Darwin binary, at `tools/go` or build it yourself:

```bash
Expand All @@ -29,8 +31,9 @@ mv go go1.12
git clone https://go.googlesource.com/go
cd go
git checkout release-branch.go1.12
# Apply the patch.
# Apply the patches.
git fetch https://go.googlesource.com/go refs/changes/17/159117/5 && git cherry-pick FETCH_HEAD
git fetch https://go.googlesource.com/go refs/changes/40/170640/6 && git cherry-pick FETCH_HEAD
# Update the version.
echo "go1.12-dev-runtime" > VERSION
# Build the runtime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
AppleTunnel instance that should be used to input packets to the tunnel.
`tunWriter` is used to output packets to the TUN (VPN).
`host` is IP address of the SOCKS proxy server.
`host` is the IP address of the SOCKS proxy server.
`port` is the port of the SOCKS proxy server.
`isUDPEnabled` indicates whether the tunnel and/or network enable UDP proxying.
Expand All @@ -46,7 +46,7 @@ FOUNDATION_EXPORT id<Tun2socksAppleTunnel> _Nullable Tun2socksConnectSocksTunnel
@class Tun2socksTunWriter;

/**
* AppleTunnel embeds the tun2socks.Tunnel interface, so it gets exported by gobind.
* AppleTunnel embeds the tun2socks.Tunnel interface so it gets exported by gobind.
*/
@interface Tun2socksAppleTunnel : NSObject <goSeqRefInterface, Tun2socksAppleTunnel> {
}
Expand All @@ -59,6 +59,9 @@ FOUNDATION_EXPORT id<Tun2socksAppleTunnel> _Nullable Tun2socksConnectSocksTunnel
- (BOOL)write:(NSData* _Nullable)data ret0_:(long*)ret0_ error:(NSError* _Nullable*)error;
@end

/**
* TunWriter is an interface that allows for outputting packets to the TUN (VPN).
*/
@interface Tun2socksTunWriter : NSObject <goSeqRefInterface, Tun2socksTunWriter> {
}
@property(strong, readonly) id _ref;
Expand Down
Binary file modified bin/macos/Tun2socks.framework/Versions/A/Tun2socks
Binary file not shown.
Binary file modified tools/go
Binary file not shown.
Binary file modified tools/gomobile
Binary file not shown.

0 comments on commit a4465cf

Please sign in to comment.