mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
commit
3df114ea6f
5 changed files with 59 additions and 46 deletions
10
README.md
10
README.md
|
@ -39,9 +39,13 @@ To check for updated gradle dependencies, run `gradle dependencyUpdates`. Additi
|
||||||
|
|
||||||
### Building on Windows
|
### Building on Windows
|
||||||
|
|
||||||
To build the Syncthing app on Windows we need to include the native Syncthing binaries:
|
To build the Syncthing app on Windows we need to have cygwin installed.
|
||||||
- Download the `syncthing-linux-386` and `syncthing-linux-arm` archives from [Syncthing releases](https://github.com/syncthing/syncthing/releases) and extract them. In each there is a `syncthing` executable. Rename and place both of these to `libs/x86/libsyncthing.so` and `libs/armeabi/libsyncthing.so` respectively.
|
|
||||||
Use `./gradlew assembleDebug` in the project directory to compile the APK.
|
From a cygwin shell in the project directory, build Go using `./make-go.bash [arch]`
|
||||||
|
After Go is built, compile syncthing using `./make-syncthing.bash [arch]`
|
||||||
|
|
||||||
|
Lastly, use `./gradlew assembleDebug` in the project directory to compile the APK,
|
||||||
|
or use Android Studio to build/deploy the APK.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 57e459e02b4b01567f92542f92cd9afde209e193
|
Subproject commit 2f6557233c5a5c311547144c34b4045640ff9f71
|
12
make-go.bash
12
make-go.bash
|
@ -70,12 +70,20 @@ if [ ! -e ../VERSION ]; then
|
||||||
echo "$(git describe --tags)" > ../VERSION
|
echo "$(git describe --tags)" > ../VERSION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./make.bash --no-banner
|
BUILDER_EXT=bash
|
||||||
|
case "$(uname)" in
|
||||||
|
*MINGW* | *WIN32* | *CYGWIN*)
|
||||||
|
BUILDER_EXT=bat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
./make.${BUILDER_EXT} --no-banner
|
||||||
|
|
||||||
cp -a ../bin "${GOROOT_FINAL}"/
|
cp -a ../bin "${GOROOT_FINAL}"/
|
||||||
cp -a ../pkg "${GOROOT_FINAL}"/
|
cp -a ../pkg "${GOROOT_FINAL}"/
|
||||||
cp -a ../src "${GOROOT_FINAL}"/
|
cp -a ../src "${GOROOT_FINAL}"/
|
||||||
|
|
||||||
if [[ -e ./make.bash ]]; then
|
if [[ -e ./make.${BUILDER_EXT} ]]; then
|
||||||
pushd ../
|
pushd ../
|
||||||
git clean -f
|
git clean -f
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -35,6 +35,12 @@ unset GOPATH #Set by build.go
|
||||||
export GOROOT=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH}
|
export GOROOT=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH}
|
||||||
export PATH=${GOROOT}/bin:${PATH}
|
export PATH=${GOROOT}/bin:${PATH}
|
||||||
|
|
||||||
|
case "$(uname)" in
|
||||||
|
*CYGWIN*)
|
||||||
|
export GOROOT=`cygpath -w $GOROOT`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
pushd ext/syncthing/src/github.com/syncthing/syncthing
|
pushd ext/syncthing/src/github.com/syncthing/syncthing
|
||||||
|
|
||||||
_GOOS=$GOOS
|
_GOOS=$GOOS
|
||||||
|
|
|
@ -1,37 +1,22 @@
|
||||||
diff --git a/net/dnsclient_unix.go b/net/dnsclient_unix.go
|
--- /net/dnsconfig_unix.go 2016-08-20 08:14:05.763235602 -0400
|
||||||
index 17188f0..15a1663 100644
|
+++ /net/dnsconfig_unix.go 2016-08-20 08:14:05.763235602 -0400
|
||||||
--- a/net/dnsclient_unix.go
|
@@ -9,15 +9,58 @@
|
||||||
+++ b/net/dnsclient_unix.go
|
|
||||||
@@ -279,12 +279,6 @@ func (conf *resolverConfig) tryUpdate(name string) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
conf.modTime = fi.ModTime()
|
|
||||||
- } else {
|
|
||||||
- // If modTime wasn't set prior, assume nothing has changed.
|
|
||||||
- if conf.modTime.IsZero() {
|
|
||||||
- return
|
|
||||||
- }
|
|
||||||
- conf.modTime = time.Time{}
|
|
||||||
}
|
|
||||||
|
|
||||||
dnsConf := dnsReadConfig(name)
|
|
||||||
diff --git a/net/dnsconfig_unix.go b/net/dnsconfig_unix.go
|
|
||||||
index 6073fdb..bd6ca41 100644
|
|
||||||
--- a/net/dnsconfig_unix.go
|
|
||||||
+++ b/net/dnsconfig_unix.go
|
|
||||||
@@ -8,7 +8,53 @@
|
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
-var defaultNS = []string{"127.0.0.1", "::1"}
|
import (
|
||||||
+import (
|
|
||||||
+ "fmt"
|
+ "fmt"
|
||||||
|
"os"
|
||||||
+ "os/exec"
|
+ "os/exec"
|
||||||
+ "strings"
|
+ "strings"
|
||||||
+)
|
"time"
|
||||||
+
|
)
|
||||||
+var currentNS []string
|
|
||||||
+
|
var (
|
||||||
|
- defaultNS = []string{"127.0.0.1:53", "[::1]:53"}
|
||||||
|
+ currentNS []string
|
||||||
|
getHostname = os.Hostname // variable for testing
|
||||||
|
)
|
||||||
|
|
||||||
+func getDefaultNS() []string {
|
+func getDefaultNS() []string {
|
||||||
+ var servers []string
|
+ var servers []string
|
||||||
+ for _, prop := range []string{"net.dns1", "net.dns2"} {
|
+ for _, prop := range []string{"net.dns1", "net.dns2"} {
|
||||||
|
@ -42,12 +27,12 @@ index 6073fdb..bd6ca41 100644
|
||||||
+ }
|
+ }
|
||||||
+ output := strings.Trim(string(outputBytes), "\n")
|
+ output := strings.Trim(string(outputBytes), "\n")
|
||||||
+ if ParseIP(output) != nil {
|
+ if ParseIP(output) != nil {
|
||||||
+ servers = append(servers, output)
|
+ servers = append(servers, output + ":53")
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if len(servers) == 0 {
|
+ if len(servers) == 0 {
|
||||||
+ servers = []string{"8.8.8.8", "8.8.4.4", "4.2.2.1"}
|
+ servers = []string{"8.8.8.8:53", "8.8.4.4:53", "4.2.2.1:53"}
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if !slicesEqual(currentNS, servers) {
|
+ if !slicesEqual(currentNS, servers) {
|
||||||
|
@ -71,24 +56,34 @@ index 6073fdb..bd6ca41 100644
|
||||||
+
|
+
|
||||||
+ return true
|
+ return true
|
||||||
+}
|
+}
|
||||||
|
+
|
||||||
type dnsConfig struct {
|
type dnsConfig struct {
|
||||||
servers []string // servers to use
|
servers []string // server addresses (in host:port form) to use
|
||||||
@@ -33,7 +79,7 @@ func dnsReadConfig(filename string) *dnsConfig {
|
search []string // rooted suffixes to append to local name
|
||||||
|
@@ -40,7 +83,7 @@
|
||||||
}
|
}
|
||||||
file, err := open(filename)
|
file, err := open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
- conf.servers = defaultNS
|
- conf.servers = defaultNS
|
||||||
+ conf.servers = getDefaultNS()
|
+ conf.servers = getDefaultNS()
|
||||||
|
conf.search = dnsDefaultSearch()
|
||||||
conf.err = err
|
conf.err = err
|
||||||
return conf
|
return conf
|
||||||
}
|
@@ -49,7 +92,7 @@
|
||||||
@@ -110,7 +156,7 @@ func dnsReadConfig(filename string) *dnsConfig {
|
if fi, err := file.file.Stat(); err == nil {
|
||||||
|
conf.mtime = fi.ModTime()
|
||||||
|
} else {
|
||||||
|
- conf.servers = defaultNS
|
||||||
|
+ conf.servers = getDefaultNS()
|
||||||
|
conf.search = dnsDefaultSearch()
|
||||||
|
conf.err = err
|
||||||
|
return conf
|
||||||
|
@@ -126,7 +169,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(conf.servers) == 0 {
|
if len(conf.servers) == 0 {
|
||||||
- conf.servers = defaultNS
|
- conf.servers = defaultNS
|
||||||
+ conf.servers = getDefaultNS()
|
+ conf.servers = getDefaultNS()
|
||||||
}
|
}
|
||||||
return conf
|
if len(conf.search) == 0 {
|
||||||
}
|
conf.search = dnsDefaultSearch()
|
||||||
|
|
Loading…
Reference in a new issue