start structure
This commit is contained in:
parent
7648057258
commit
869abf2ab1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.vscode/
|
17
cmd/weather/server.go
Normal file
17
cmd/weather/server.go
Normal 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)
|
||||
}
|
25
internal/net.go
Normal file
25
internal/net.go
Normal 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))
|
||||
}
|
Loading…
Reference in New Issue
Block a user