server

package
v0.0.0-...-76d690f Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEADER_USER      = "X-Tellus-Market-User"
	HEADER_REQUESTID = "X-Tellus-Market-RequestID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CountRequest

type CountRequest struct {
	ProductID string `json:"product_id"`
	UserID    string `json:"user_id"`
	Token     string `json:"token"`
	RequestID string `json:"request_id"`
}

type ErrorMessage

type ErrorMessage struct {
	Error string `json:"error"`
}

type LoggingResponseWriter

type LoggingResponseWriter struct {
	StatusCode int
	HeaderMap  http.Header
	Size       int
	// contains filtered or unexported fields
}

func NewLoggingResponseWriter

func NewLoggingResponseWriter(w http.ResponseWriter) *LoggingResponseWriter

func (*LoggingResponseWriter) Header

func (w *LoggingResponseWriter) Header() http.Header

func (*LoggingResponseWriter) Write

func (w *LoggingResponseWriter) Write(b []byte) (int, error)

func (*LoggingResponseWriter) WriteHeader

func (w *LoggingResponseWriter) WriteHeader(statusCode int)

type Server

type Server struct {
	Config      *config.Config
	Upstream    *url.URL
	Logger      *log.Entry
	CounterChan chan<- CountRequest
}

func New

func New(cfg *config.Config) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) StartCountRequestLoop

func (s *Server) StartCountRequestLoop() chan<- CountRequest

Jump to

Keyboard shortcuts

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