start structure

This commit is contained in:
RouxAntoine 2021-02-24 08:27:48 +01:00
parent 7648057258
commit 869abf2ab1
4 changed files with 46 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.vscode/

17
cmd/weather/server.go Normal file
View File

@ -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)
}

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module go/weather
go 1.16

25
internal/net.go Normal file
View File

@ -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))
}