handler

package
v0.0.0-...-ab1a295 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfigProvider

func NewConfigProvider() (config.Provider, error)

NewConfigProvider returns a config.Provider for YAML configuration

func NewHTTPServer

func NewHTTPServer(
	mux *mux.Router,
	cfg config.Provider,
) *http.Server

NewHTTPServer provides a new HTTP server listener

func NewLogger

func NewLogger(cfg config.Provider) (*zap.Logger, error)

NewLogger returns a new *zap.Logger

func NewServerRouter

func NewServerRouter(s *SSRFSheriffRouter) *mux.Router

NewServerRouter returns a new mux.Router for handling any HTTP request to /.*

func StartFilesGenerator

func StartFilesGenerator(cfg config.Provider)

StartFilesGenerator starts the function which is dynamically generating JPG/PNG formats with the secret token rendered in the media

func StartServer

func StartServer(server *http.Server, lc fx.Lifecycle)

StartServer starts the HTTP server

Types

type SSRFSheriffRouter

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

SSRFSheriffRouter is a wrapper around mux.Router to handle HTTP requests to the sheriff, with logging

func NewSSRFSheriffRouter

func NewSSRFSheriffRouter(
	logger *zap.Logger,
	cfg config.Provider,
) *SSRFSheriffRouter

NewSSRFSheriffRouter returns a new SSRFSheriffRouter which is used to route and handle all HTTP requests

func (*SSRFSheriffRouter) PathHandler

func (s *SSRFSheriffRouter) PathHandler(w http.ResponseWriter, r *http.Request)

PathHandler is the main handler for all inbound requests

type SerializableResponse

type SerializableResponse struct {
	SecretToken string `json:"token" xml:"token"`
}

SerializableResponse is a generic type which both can be safely serialized to both XML and JSON

Jump to

Keyboard shortcuts

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