Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
任意のタイミングで終了可能なサーバ。
Usage
srv := NewHttpServer("0.0.0.0:8080", ServerArgs{})
srv.Start()
go func() {
time.Sleep(time.Second)
srv.Stop()
}
err := srv.Wait()
func NewHttpServer ¶
func NewHttpServer(addr string, router http.Handler) *HttpServer
func (*HttpServer) Addr ¶
func (srv *HttpServer) Addr() string
Addr returns binded address of this server.
func (*HttpServer) Start ¶
func (srv *HttpServer) Start() error
HTTPサーバといくつかのハンドラを起動する。 この関数の実行終了後、Addr()から実際にlistenされたアドレスとポート番号を取得出来る。
func (*HttpServer) Url ¶
func (srv *HttpServer) Url() string
Url returns complete URL with prefix "http://".
Click to show internal directories.
Click to hide internal directories.