http - Connecting to my own golang sever from outside world -


so have code written in go:

// firstserver - first server package main  import (     "fmt"     "log"     "net/http" )  func main() {     http.handlefunc("/", handler)     err := http.listenandserve(":80", nil)     if err != nil {         log.fatal(err)     } }  // handler - handler function normal enter func handler(w http.responsewriter, r *http.request) {     fmt.fprintln(w, "you're connected") } 

now, when go browser , type localhost:80 (or localhost), page loads, , see message you're connected. wanted try connect other devices too. took other laptop. checked adapter address, 192.168.0.15. when typed 192.168.0.15:80 on other laptop, worked again, cool!

primarly trying simple server use on phone when @ college, check schedules, have notes, etc. took smartphone, disconnected wifi, switched smartphones internet , dumbly typed 192.168.0.15:80 again. knew wouldn't work, cuz it's not external ip. , didn't.

so looked ip address isp provider gives me, looks this: 88.156.xxx.xx. on phone typed 88.156.xxx.xx:80 , didn't work. tried search , other resources on web on how connect remotely server outside of lan. , didn't find answer. there way without, don't know, paying sorts of things, or this?

p.s i'm living in rented room, there's not me in house, don't have way configure router (manually or on web)

one way can deploy on aws free tier instance public ip(https://aws.amazon.com/free/). once done spinning ec2 instance (https://aws.amazon.com/free/), copy binary of web server instance scp -i mykey.pem somefile.txt root@my.ec2.id.amazonaws.com:/ need ensure security group on instance allows ingress internet(0.0.0.0/0) on port

to access it: use either public ip or public dns of ec2 instance along port number of server(in case 80)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -