Browse Source

Merge remote-tracking branch 'upstream/master'

Adam Pritchard 11 years ago
parent
commit
d24bf310dc
6 changed files with 21 additions and 19 deletions
  1. 3 6
      AndroidLibrary/README.md
  2. 7 9
      README.md
  3. 1 1
      psiphon/LookupIP_nobind.go
  4. 2 2
      psiphon/TCPConn_windows.go
  5. 5 1
      psiphon/serverApi.go
  6. 3 0
      psiphon/utils.go

+ 3 - 6
AndroidLibrary/README.md

@@ -38,11 +38,8 @@ Follow Go Android documentation:
     main.go                - stub main package for library
     main.go                - stub main package for library
 ```
 ```
 
 
-NOTE: may change after Go 1.4 is released.
-
-* Requires Go 1.4 or later
-  * At this time, android/arm support is not yet released but.
-  * Install Go from source. The Android instructions are here:
+* Requires Go 1.4 or later.
+* Install Go from source. The Android instructions are here:
 [https://code.google.com/p/go/source/browse/README?repo=mobile](https://code.google.com/p/go/source/browse/README?repo=mobile).
 [https://code.google.com/p/go/source/browse/README?repo=mobile](https://code.google.com/p/go/source/browse/README?repo=mobile).
   * In summary, download and install the Android NDK, use a script to make a [standalone toolchain](https://developer.android.com/tools/sdk/ndk/index.html#Docs), and use that toolchain to build android/arm support within the Go source install. Then cross compile as usual.
   * In summary, download and install the Android NDK, use a script to make a [standalone toolchain](https://developer.android.com/tools/sdk/ndk/index.html#Docs), and use that toolchain to build android/arm support within the Go source install. Then cross compile as usual.
 * `$GOPATH/bin/gobind -lang=go github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary/psi > go_psi/go_psi.go`
 * `$GOPATH/bin/gobind -lang=go github.com/Psiphon-Labs/psiphon-tunnel-core/AndroidLibrary/psi > go_psi/go_psi.go`
@@ -52,7 +49,7 @@ NOTE: may change after Go 1.4 is released.
 Using
 Using
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
 
 
-1. Build from source or use the [provided shared object binary](TODO: link to release) and Java source files
+1. Build the shared object library from source or use the [binary release](https://github.com/Psiphon-Labs/psiphon-tunnel-core/releases) and Java source files
 1. Add Go/Java integration files `java_golang/go/*.java` to your `$src/go`
 1. Add Go/Java integration files `java_golang/go/*.java` to your `$src/go`
 1. Add `java_psi/go/psi/Psi.java` to your `$src/go/psi`
 1. Add `java_psi/go/psi/Psi.java` to your `$src/go/psi`
 1. Add `libgojni.so` to your Android app
 1. Add `libgojni.so` to your Android app

+ 7 - 9
README.md

@@ -16,7 +16,7 @@ This project is currently at the proof-of-concept stage. Current production Psip
 Setup
 Setup
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
 
 
-* Go 1.3 (or higher) is required.
+* Go 1.4 (or higher) is required.
 * In this repository, run `go build` to make the `psiphon-tunnel-core` binary.
 * In this repository, run `go build` to make the `psiphon-tunnel-core` binary.
 * Note that the `psiphon` package is imported using the absolute path `github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon`; without further local configuration, `go` will use this version of the code and not the local copy in the repository.
 * Note that the `psiphon` package is imported using the absolute path `github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon`; without further local configuration, `go` will use this version of the code and not the local copy in the repository.
 * This project builds and runs on recent versions of Windows, Linux, and Mac OS X.
 * This project builds and runs on recent versions of Windows, Linux, and Mac OS X.
@@ -43,25 +43,23 @@ Setup
     ```
     ```
 
 
 * Replace each `<placeholder>` with a value from your Psiphon network. The Psiphon server-side stack is open source and can be found in our  [Psiphon 3 repository](https://bitbucket.org/psiphon/psiphon-circumvention-system). If you would like to use the Psiphon Inc. network, contact <developer-support@psiphon.ca>.
 * Replace each `<placeholder>` with a value from your Psiphon network. The Psiphon server-side stack is open source and can be found in our  [Psiphon 3 repository](https://bitbucket.org/psiphon/psiphon-circumvention-system). If you would like to use the Psiphon Inc. network, contact <developer-support@psiphon.ca>.
-* The project builds and runs on Android. At this time, Android support is in the developer branch of Go, so build Go from source and use the Android NDK to build android/arm target support. See the sample [AndroidApp README](AndroidApp/README.md) for more information about building the Go binary, along with a sample Android app that uses it.
+* The project builds and runs on Android. See the [AndroidLibrary README](AndroidLibrary/README.md) for more information about building the Go component, and the [AndroidApp README](AndroidApp/README.md) for a sample Android app that uses it.
 
 
 Roadmap
 Roadmap
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------
 
 
 ### TODO (short-term)
 ### TODO (short-term)
 
 
+* sometimes fails to promptly detect loss of connection after device sleep
 * requirements for integrating with Windows client
 * requirements for integrating with Windows client
   * split tunnel support
   * split tunnel support
-  * implement page view and bytes transferred stats
   * resumable download of client upgrades
   * resumable download of client upgrades
 * Android app
 * Android app
   * open home pages
   * open home pages
-  * Go binary PIE, or use a Go library and JNI
   * settings UI (e.g., region selection)
   * settings UI (e.g., region selection)
-* sometimes fails to promptly detect loss of connection after device sleep
-* PendingConns: is interrupting connection establishment worth the extra code complexity?
-* log noise: "use of closed network connection"
-* log noise(?): 'Unsolicited response received on idle HTTP channel starting with "H"'
+* log noise
+  * "use of closed network connection"
+  * 'Unsolicited response received on idle HTTP channel starting with "H"'
 
 
 ### TODO (future)
 ### TODO (future)
 
 
@@ -72,7 +70,7 @@ Roadmap
   * unfronted meek almost makes this obsolete, since meek sessions survive underlying
   * unfronted meek almost makes this obsolete, since meek sessions survive underlying
      HTTP transport socket disconnects. The client could prefer unfronted meek protocol
      HTTP transport socket disconnects. The client could prefer unfronted meek protocol
      when handshake returns a preemptive_reconnect_lifetime_milliseconds.
      when handshake returns a preemptive_reconnect_lifetime_milliseconds.
-  * could also be accomplished with TunnelPoolSize > 1 and staggaring the establishment times
+  * could also be accomplished with TunnelPoolSize > 1 and staggering the establishment times
 * implement local traffic stats (e.g., to display bytes sent/received)
 * implement local traffic stats (e.g., to display bytes sent/received)
 * more formal control interface (w/ event messages)?
 * more formal control interface (w/ event messages)?
 * support upgrading core only
 * support upgrading core only

+ 1 - 1
psiphon/LookupIP_nobind.go

@@ -30,7 +30,7 @@ import (
 // simply uses net.LookuIP.
 // simply uses net.LookuIP.
 func LookupIP(host string, config *DialConfig) (addrs []net.IP, err error) {
 func LookupIP(host string, config *DialConfig) (addrs []net.IP, err error) {
 	if config.BindToDeviceProvider != nil {
 	if config.BindToDeviceProvider != nil {
-		return nil, errors.New("LookupIP with bind not supported on this platform")
+		return nil, ContextError(errors.New("LookupIP with bind not supported on this platform"))
 	}
 	}
 	return net.LookupIP(host)
 	return net.LookupIP(host)
 }
 }

+ 2 - 2
psiphon/TCPConn_windows.go

@@ -43,8 +43,8 @@ type interruptibleDialResult struct {
 }
 }
 
 
 func interruptibleTCPDial(addr string, config *DialConfig) (conn *TCPConn, err error) {
 func interruptibleTCPDial(addr string, config *DialConfig) (conn *TCPConn, err error) {
-	if config.BindToDevice != nil {
-		Fatal("psiphon.interruptibleTCPDial with bind not supported on Windows")
+	if config.BindToDeviceProvider != nil {
+		return nil, ContextError(errors.New("psiphon.interruptibleTCPDial with bind not supported on Windows"))
 	}
 	}
 
 
 	conn = &TCPConn{
 	conn = &TCPConn{

+ 5 - 1
psiphon/serverApi.go

@@ -91,7 +91,11 @@ func (session *Session) DoStatusRequest(statsPayload json.Marshaler, final bool)
 		&ExtraParam{"connected", connected})
 		&ExtraParam{"connected", connected})
 
 
 	err = session.doPostRequest(url, "application/json", bytes.NewReader(statsPayloadJSON))
 	err = session.doPostRequest(url, "application/json", bytes.NewReader(statsPayloadJSON))
-	return ContextError(err)
+	if err != nil {
+		return ContextError(err)
+	}
+
+	return nil
 }
 }
 
 
 // doHandshakeRequest performs the handshake API request. The handshake
 // doHandshakeRequest performs the handshake API request. The handshake

+ 3 - 0
psiphon/utils.go

@@ -77,6 +77,9 @@ func TrimError(err error) error {
 
 
 // ContextError prefixes an error message with the current function name
 // ContextError prefixes an error message with the current function name
 func ContextError(err error) error {
 func ContextError(err error) error {
+	if err == nil {
+		return nil
+	}
 	pc, _, line, _ := runtime.Caller(1)
 	pc, _, line, _ := runtime.Caller(1)
 	funcName := runtime.FuncForPC(pc).Name()
 	funcName := runtime.FuncForPC(pc).Name()
 	return fmt.Errorf("%s#%d: %s", funcName, line, err)
 	return fmt.Errorf("%s#%d: %s", funcName, line, err)