diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d74e21 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/ diff --git a/cmd/weather/server.go b/cmd/weather/server.go new file mode 100644 index 0000000..6fec379 --- /dev/null +++ b/cmd/weather/server.go @@ -0,0 +1,17 @@ +package main + +import ( + "go/weather/internal" + "io/ioutil" + "net/http" +) + +func main() { + + http.Handler(func(rw http.ResponseWriter, r *http.Request) { + + }) + + certFile := ioutil.ReadFile("./") + http.ListenAndServeTLS(internal.NewListenAddr("127.0.0.1", 443).String(), "", "", nil) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5357e91 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module go/weather + +go 1.16 diff --git a/internal/net.go b/internal/net.go new file mode 100644 index 0000000..755cd44 --- /dev/null +++ b/internal/net.go @@ -0,0 +1,25 @@ +package internal + +import "fmt" + +//ListenAddr host port listen information +type ListenAddr interface { + String() string +} + +type listenAddr struct { + Addr string + Port int +} + +//NewListenAddr create new instance of ListenAddr +func NewListenAddr(addr string, port int) listenAddr { + return listenAddr{ + Addr: addr, + Port: port, + } +} + +func (l listenAddr) String() string { + return fmt.Sprintf("%s:%s", l.Addr, fmt.Sprint(l.Port)) +}