http

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNonceNotInRange = errors.New("Nonce submit is not in aceptable range")

ErrNonceNotInRange error when nonce not in aceptable range

Functions

func NewAuthenticator

func NewAuthenticator(readKeyID, readKeySecret, writeKeyID, writeKeySecret string) (*httpsign.Authenticator, error)

NewAuthenticator create a httpsign.Authenticator to check the message signing is valid or not

func NewPermissioner

func NewPermissioner(readKeyID, writeKeyID string) (gin.HandlerFunc, error)

NewPermissioner creates a gin Handle Func to controll permission currently there is only 2 permission for POST/GET requests

Types

type NonceValidator

type NonceValidator struct {
	// TimeGap is max time different between client submit timestamp
	// and server time that considered valid. The time precision is millisecond.
	TimeGap uint64
}

NonceValidator checking validate by time range

func NewNonceValidator

func NewNonceValidator() *NonceValidator

NewNonceValidator return NonceValidator with default value (30 second)

func (*NonceValidator) Validate

func (v *NonceValidator) Validate(r *http.Request) error

Validate return error when checking if header date is valid or not

type Server

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

Server is HTTP server of gateway service.

func NewServer

func NewServer(addr, tradeLogsURL, reserveRatesURL, userURL, priceAnalyticURL string,
	auth *httpsign.Authenticator,
	perm gin.HandlerFunc,
	logger *zap.Logger) (*Server, error)

NewServer creates new instance of gateway HTTP server.

func (*Server) Start

func (svr *Server) Start() error

Start runs the HTTP gateway server.

Jump to

Keyboard shortcuts

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