Replies: 2 comments 4 replies
package main
import (
"errors"
"github.com/labstack/echo/v4"
"net"
"net/http"
)
func main() {
e := echo.New()
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hi")
})
l, err := net.Listen("tcp4", ":1323")
if err != nil {
e.Logger.Fatal(err)
}
s := http.Server{
Handler: e,
}
if err := s.Serve(l); err != nil && !errors.Is(err, http.ErrServerClosed) {
e.Logger.Fatal(err)
}
}Other suitable "network" values can be seen here https://github.com/golang/go/blob/071aed2aaa0ed819582c5bff44b70d43c61f504a/src/net/dial.go#L231-L238 |
0 replies
|
How would you do this AutoTLS cookbook? or even StartTLS ? |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi All,
How do you start echo, and make it listen on ipv4? When I start it on my linux VM it only listens on ipv6. I see that there is a way to customize echo for a listener as follows, but I get a "main.go:45:12: undefined: net" error.
l, err := net.Listen("tcp", ":1323")
if err != nil {
e.Logger.Fatal(err)
}
e.Listener = l
Thanks for any help.
All reactions