package servers

import "github.com/gobuffalo/buffalo/servers"

Index

Types

type Listener

type Listener struct {
	*http.Server
	Listener net.Listener
}

Listener server for using a pre-defined net.Listener

func UnixSocket

func UnixSocket(addr string) (*Listener, error)

UnixSocket returns a new Listener on that address

func (*Listener) SetAddr

func (s *Listener) SetAddr(addr string)

SetAddr sets the servers address, if it hasn't already been set

func (*Listener) Start

func (s *Listener) Start(c context.Context, h http.Handler) error

Start the server

func (*Listener) String

func (s *Listener) String() string

String returns a string representation of a Listener

type Server

type Server interface {
	Shutdown(context.Context) error
	Start(context.Context, http.Handler) error
	SetAddr(string)
}

Server allows for custom server implementations

func Wrap

func Wrap(s *http.Server) Server

Wrap converts a standard *http.Server to a buffalo.Server

func WrapListener

func WrapListener(s *http.Server, l net.Listener) Server

WrapListener wraps an *http.Server and a net.Listener

func WrapTLS

func WrapTLS(s *http.Server, certFile string, keyFile string) Server

WrapTLS Server converts a standard *http.Server to a buffalo.Server but makes sure it is run with TLS.

type Simple

type Simple struct {
	*http.Server
}

Simple server

func New

func New() *Simple

New Simple server

func (*Simple) SetAddr

func (s *Simple) SetAddr(addr string)

SetAddr sets the servers address, if it hasn't already been set

func (*Simple) Start

func (s *Simple) Start(c context.Context, h http.Handler) error

Start the server

func (*Simple) String

func (s *Simple) String() string

String returns a string representation of a Simple server

type TLS

type TLS struct {
	*http.Server
	CertFile string
	KeyFile  string
}

TLS server

func (*TLS) SetAddr

func (s *TLS) SetAddr(addr string)

SetAddr sets the servers address, if it hasn't already been set

func (*TLS) Start

func (s *TLS) Start(c context.Context, h http.Handler) error

Start the server

func (*TLS) String

func (s *TLS) String() string

String returns a string representation of a Listener

Source Files

listener.go servers.go simple.go tls.go

Version
v1.1.2 (latest)
Published
May 17, 2025
Platform
js/wasm
Imports
4 packages
Last checked
1 week ago

Tools for package owners.