Documentation
¶
Index ¶
- Constants
- Variables
- type HTTPServer
- type MethodHandler
- type Option
- func WithHTTPHandler(method, path string, handler fasthttp.RequestHandler) Option
- func WithIdleTimeout(d time.Duration) Option
- func WithKafkaBrokers(brokers string) Option
- func WithKafkaGitHubTopic(s string) Option
- func WithListenAddr(addr string) Option
- func WithLogger(l *slog.Logger) Option
- func WithReadTimeout(d time.Duration) Option
- func WithWriteTimeout(d time.Duration) Option
- type Server
Constants ¶
View Source
const ( ServerDefaultReadTimeout = 5 * time.Second ServerDefaultWriteTimeout = 10 * time.Second ServerDefaultIdleTimeout = 15 * time.Second ServerDefaultListenAddr = ":8000" )
default values.
Variables ¶
View Source
var ServerVersion string
ServerVersion holds webhookserver release version.
Functions ¶
This section is empty.
Types ¶
type HTTPServer ¶
HTTPServer defines the basic operations for managing an HTTP server's lifecycle.
type MethodHandler ¶
type MethodHandler map[string]fasthttp.RequestHandler
MethodHandler holds http method and http handler function information.
type Option ¶
Option represents option function type.
func WithHTTPHandler ¶
func WithHTTPHandler(method, path string, handler fasthttp.RequestHandler) Option
WithHTTPHandler adds given http handler to handler stack.
func WithIdleTimeout ¶
WithIdleTimeout sets idle timeout.
func WithKafkaBrokers ¶
WithKafkaBrokers sets kafka brokers list.
func WithKafkaGitHubTopic ¶
WithKafkaGitHubTopic sets kafka topic name for github webhooks.
func WithReadTimeout ¶
WithReadTimeout sets read timeout.
func WithWriteTimeout ¶
WithWriteTimeout sets write timeout.
type Server ¶
type Server struct { Logger *slog.Logger FastHTTP *fasthttp.Server Handlers map[string]MethodHandler ListenAddr string KafkaGitHubTopic kafkacp.KafkaTopicIdentifier KafkaBrokers kafkacp.KafkaBrokers ReadTimeout time.Duration WriteTimeout time.Duration IdleTimeout time.Duration }
Server represents server configuration. Must implements HTTPServer interface.
Click to show internal directories.
Click to hide internal directories.