@@ -20,6 +20,7 @@ import (
20
20
"bytes"
21
21
"crypto/md5"
22
22
crand "crypto/rand"
23
+ "crypto/tls"
23
24
"errors"
24
25
"fmt"
25
26
"io"
@@ -32,25 +33,21 @@ import (
32
33
"time"
33
34
34
35
"github.com/ethereum/go-ethereum/log"
36
+ colorable "github.com/mattn/go-colorable"
35
37
"github.com/pborman/uuid"
36
38
37
39
cli "gopkg.in/urfave/cli.v1"
38
40
)
39
41
40
42
func generateEndpoints (scheme string , cluster string , from int , to int ) {
41
43
if cluster == "prod" {
42
- cluster = ""
43
- } else if cluster == "local" {
44
44
for port := from ; port <= to ; port ++ {
45
- endpoints = append (endpoints , fmt .Sprintf ("%s://localhost:%v " , scheme , port ))
45
+ endpoints = append (endpoints , fmt .Sprintf ("%s://%v.swarm-gateways.net " , scheme , port ))
46
46
}
47
- return
48
47
} else {
49
- cluster = cluster + "."
50
- }
51
-
52
- for port := from ; port <= to ; port ++ {
53
- endpoints = append (endpoints , fmt .Sprintf ("%s://%v.%sswarm-gateways.net" , scheme , port , cluster ))
48
+ for port := from ; port <= to ; port ++ {
49
+ endpoints = append (endpoints , fmt .Sprintf ("%s://swarm-%v-%s.stg.swarm-gateways.net" , scheme , port , cluster ))
50
+ }
54
51
}
55
52
56
53
if includeLocalhost {
@@ -59,6 +56,9 @@ func generateEndpoints(scheme string, cluster string, from int, to int) {
59
56
}
60
57
61
58
func cliUploadAndSync (c * cli.Context ) error {
59
+ log .PrintOrigins (true )
60
+ log .Root ().SetHandler (log .LvlFilterHandler (log .Lvl (verbosity ), log .StreamHandler (colorable .NewColorableStderr (), log .TerminalFormat (true ))))
61
+
62
62
defer func (now time.Time ) { log .Info ("total time" , "time" , time .Since (now ), "size (kb)" , filesize ) }(time .Now ())
63
63
64
64
generateEndpoints (scheme , cluster , from , to )
@@ -112,7 +112,10 @@ func fetch(hash string, endpoint string, original []byte, ruid string) error {
112
112
time .Sleep (3 * time .Second )
113
113
114
114
log .Trace ("http get request" , "ruid" , ruid , "api" , endpoint , "hash" , hash )
115
- res , err := http .Get (endpoint + "/bzz:/" + hash + "/" )
115
+ client := & http.Client {Transport : & http.Transport {
116
+ TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
117
+ }}
118
+ res , err := client .Get (endpoint + "/bzz:/" + hash + "/" )
116
119
if err != nil {
117
120
log .Warn (err .Error (), "ruid" , ruid )
118
121
return err
0 commit comments