callbackserver

package
v2.48.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTimedOut

func IsTimedOut(err error) bool

IsTimedOut asserts timedOutError.

Types

type CallbackFunc

type CallbackFunc func(http.ResponseWriter, *http.Request) (interface{}, error)

type CallbackServer

type CallbackServer struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*CallbackServer, error)

func (*CallbackServer) Port

func (cs *CallbackServer) Port() int

func (*CallbackServer) Run

func (cs *CallbackServer) Run(ctx context.Context, callback CallbackFunc) (interface{}, error)

Run starts a server listening at a given path and port and calls a callback function as soon as that path is hit.

It blocks and waits until the given path is hit, or until the context deadline is reached, then shuts down the server and returns the result of the callback function.

type Config

type Config struct {
	Host              string // empty to listen on all network interfaces
	Port              int
	RedirectURI       string
	ReadHeaderTimeout time.Duration
}

Jump to

Keyboard shortcuts

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