Remove Android hacks (fixes #2505)

Also fixes what I think migh thave been a bug where we did not use the
proxy for usage reports. And removes the BuildEnv field that we don't
need any more.
This commit is contained in:
Jakob Borg 2015-11-24 20:46:07 +01:00
parent ded0925155
commit 95cfc50fbd
4 changed files with 9 additions and 18 deletions

View File

@ -448,7 +448,6 @@ func ldflags() string {
fmt.Fprintf(b, " -X main.BuildStamp%c%d", sep, buildStamp()) fmt.Fprintf(b, " -X main.BuildStamp%c%d", sep, buildStamp())
fmt.Fprintf(b, " -X main.BuildUser%c%s", sep, buildUser()) fmt.Fprintf(b, " -X main.BuildUser%c%s", sep, buildUser())
fmt.Fprintf(b, " -X main.BuildHost%c%s", sep, buildHost()) fmt.Fprintf(b, " -X main.BuildHost%c%s", sep, buildHost())
fmt.Fprintf(b, " -X main.BuildEnv%c%s", sep, buildEnvironment())
return b.String() return b.String()
} }

View File

@ -49,7 +49,6 @@ import (
var ( var (
Version = "unknown-dev" Version = "unknown-dev"
Codename = "Beryllium Bedbug" Codename = "Beryllium Bedbug"
BuildEnv = "default"
BuildStamp = "0" BuildStamp = "0"
BuildDate time.Time BuildDate time.Time
BuildHost = "unknown" BuildHost = "unknown"
@ -108,7 +107,7 @@ func init() {
BuildDate = time.Unix(int64(stamp), 0) BuildDate = time.Unix(int64(stamp), 0)
date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST") date := BuildDate.UTC().Format("2006-01-02 15:04:05 MST")
LongVersion = fmt.Sprintf(`syncthing %s "%s" (%s %s-%s %s) %s@%s %s`, Version, Codename, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildEnv, BuildUser, BuildHost, date) LongVersion = fmt.Sprintf(`syncthing %s "%s" (%s %s-%s) %s@%s %s`, Version, Codename, runtime.Version(), runtime.GOOS, runtime.GOARCH, BuildUser, BuildHost, date)
if os.Getenv("STTRACE") != "" { if os.Getenv("STTRACE") != "" {
logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile

View File

@ -13,7 +13,6 @@ import (
"crypto/tls" "crypto/tls"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net"
"net/http" "net/http"
"runtime" "runtime"
"sort" "sort"
@ -249,19 +248,14 @@ func (s *usageReportingService) sendUsageReport() error {
var b bytes.Buffer var b bytes.Buffer
json.NewEncoder(&b).Encode(d) json.NewEncoder(&b).Encode(d)
transp := &http.Transport{} client := &http.Client{
client := &http.Client{Transport: transp} Transport: &http.Transport{
if BuildEnv == "android" { Dial: dialer.Dial,
// This works around the lack of DNS resolution on Android... :( Proxy: http.ProxyFromEnvironment,
transp.Dial = func(network, addr string) (net.Conn, error) { TLSClientConfig: &tls.Config{
return dialer.Dial(network, "194.126.249.13:443") InsecureSkipVerify: s.cfg.Options().URPostInsecurely,
} },
} },
if s.cfg.Options().URPostInsecurely {
transp.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
} }
_, err := client.Post(s.cfg.Options().URURL, "application/json", &b) _, err := client.Post(s.cfg.Options().URURL, "application/json", &b)
return err return err

View File

@ -50,7 +50,6 @@ var (
DefaultDiscoveryServers = append(DefaultDiscoveryServersV4, DefaultDiscoveryServersV6...) DefaultDiscoveryServers = append(DefaultDiscoveryServersV4, DefaultDiscoveryServersV6...)
// DefaultDiscoveryServersIP is used by the usage reporting. // DefaultDiscoveryServersIP is used by the usage reporting.
// XXX: Detect Android, and use this is we still don't have working DNS?
DefaultDiscoveryServersIP = []string{ DefaultDiscoveryServersIP = []string{
"https://194.126.249.5/?id=SR7AARM-TCBUZ5O-VFAXY4D-CECGSDE-3Q6IZ4G-XG7AH75-OBIXJQV-QJ6NLQA", "https://194.126.249.5/?id=SR7AARM-TCBUZ5O-VFAXY4D-CECGSDE-3Q6IZ4G-XG7AH75-OBIXJQV-QJ6NLQA",
"https://45.55.230.38/?id=AQEHEO2-XOS7QRA-X2COH5K-PO6OPVA-EWOSEGO-KZFMD32-XJ4ZV46-CUUVKAS", "https://45.55.230.38/?id=AQEHEO2-XOS7QRA-X2COH5K-PO6OPVA-EWOSEGO-KZFMD32-XJ4ZV46-CUUVKAS",