httpserver

package
v1.32.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package httpserver는 HTTP server를 위한 작은 lifecycle helper를 제공합니다.

패키지 소개

이 패키지는 shared-go runtime 계층에서 재사용하는 HTTP server start/shutdown 흐름만 공통화합니다. process signal 처리, shutdown timeout 생성, runtime 별 background worker 정리는 lifecycle 패키지와 각 runtime 이 계속 담당합니다.

주요 사용 패턴

runtime 은 lifecycle.Run 의 Start hook 에서 Start(server, logger, errCh) 를 호출하고, Shutdown hook 에서 Shutdown(ctx, server, "shutdown http server") 를 호출합니다. server construction 과 router/H2C 조립은 호출부의 기존 책임으로 남깁니다.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run added in v1.32.0

func Run(ctx context.Context, server Server, shutdownTimeout time.Duration) error

func Shutdown

func Shutdown(ctx context.Context, server Server, errorText string) error

Shutdown 은 server.Shutdown(ctx) 결과를 errorText prefix 와 함께 wrap 합니다.

func Start

func Start(server Server, logger *slog.Logger, errCh chan<- error)

Start 는 server.ListenAndServe 를 background goroutine 에서 실행합니다.

func StartServerWithPrefix

func StartServerWithPrefix(server Server, errorText string, logger *slog.Logger, errCh chan<- error)

Types

type Server

type Server interface {
	ListenAndServe() error
	Shutdown(ctx context.Context) error
}

Server 는 HTTP server lifecycle 추상화입니다.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL