Support any golang net supported protocol
This commit is contained in:
parent
b9af31e2f5
commit
cb6c12354a
3 changed files with 11 additions and 5 deletions
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
|
|
@ -27,8 +27,12 @@ func main() {
|
|||
),
|
||||
),
|
||||
)
|
||||
addr := fmt.Sprintf(":%d", conf.Conf.Port)
|
||||
log.Fatal(http.ListenAndServe(addr, router))
|
||||
|
||||
listener, err := net.Listen(conf.Conf.Protocol, conf.Conf.Address)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Fatal(http.Serve(listener, router))
|
||||
}
|
||||
|
||||
func logger(next http.Handler) http.Handler {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue