Skip to content

Commit

Permalink
get torrent file using ipfs gateway with fixed address (127.0.0.1) to…
Browse files Browse the repository at this point in the history
… fix app behind firewall [ci skip] [circleci skip]
  • Loading branch information
baabeetaa committed Feb 15, 2017
1 parent 7eb1574 commit 6a488e1
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions service/torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,10 @@ func Get_Torrent_From_Ipfs(mhash string) (data []byte, err error) {
/////////////////////////////////
// get the file first
//url := app.GlogchainConfigGlobal.IpFsGateway + "/ipfs/" + mhash
////log.Println("url", url)
//resp, err := http.Get(url)
//if err != nil {
// log.Println(err.Error())
// return
//}
//defer resp.Body.Close()

// get from api instead of from gateway
url := app.GlogchainConfigGlobal.IpFsAPI + "/api/v0/get?arg=" + mhash
// remember to config ipfs ( ipfs service ) to listen on 0.0.0.0 so that it can be accessed behind firewall,
// behind firewall: 127.0.0.1, external still accessed via app.GlogchainConfigGlobal.IpFsGateway
url := "http://127.0.0.1:8080/ipfs/" + mhash
//log.Println("url", url)
resp, err := http.Get(url)
if err != nil {
Expand All @@ -103,7 +97,6 @@ func Get_Torrent_From_Ipfs(mhash string) (data []byte, err error) {
}
defer resp.Body.Close()


/////////////////////////////////
// load to torrent
//r := bytes.NewReader(data)
Expand Down

0 comments on commit 6a488e1

Please sign in to comment.