Documentation
¶
Overview ¶
* Package trp implements a JSON web server for the Travel Rule Protocol that was * designed and developed by OpenVASP. This is a separate server from the rest of the * envoy services so that it can be enabled, authenticated, and managed independently.
Index ¶
- Constants
- Variables
- func APICheck(c *gin.Context)
- func TRPInfo(c *gin.Context) *trp.Info
- func VerifyTRPCore(c *gin.Context)
- type Server
- func (s *Server) Confirmation(c *gin.Context)
- func (s *Server) Healthz(c *gin.Context)
- func (s *Server) Identity(c *gin.Context)
- func (s *Server) Inquiry(c *gin.Context)
- func (s *Server) Maintenance() gin.HandlerFunc
- func (s *Server) NotAllowed(c *gin.Context)
- func (s *Server) NotFound(c *gin.Context)
- func (s *Server) Readyz(c *gin.Context)
- func (s *Server) Resolve(c *gin.Context)
- func (s *Server) Serve(errc chan<- error) (err error)
- func (s *Server) SetStatus(health, ready bool)
- func (s *Server) Shutdown() (err error)
- func (s *Server) Status(c *gin.Context)
- func (s *Server) TRPExtensions(c *gin.Context)
- func (s *Server) TRPVersion(c *gin.Context)
- func (s *Server) URL() string
- func (s *Server) Uptime(c *gin.Context)
- func (s *Server) WebhookEnabled() bool
- func (s *Server) WebhookInquiry(packet *postman.TRPPacket) (out *trp.Resolution, err error)
Constants ¶
const (
SupportedAPIVersions = ">=2.1.0 <3.2.0"
)
Variables ¶
var ( ErrMethodNotAllowed = errors.New(http.StatusText(http.StatusMethodNotAllowed)) ErrMissingRequestIdentifier = errors.New("missing request identifier in header") ErrSupportedVersions = fmt.Errorf("unsupported API version; this server supports %s", SupportedAPIVersions) ErrMalformedContentType = errors.New("malformed content-type header") ErrUnsupportedContentType = errors.New("content-type header must be application/json") )
Functions ¶
func APICheck ¶ added in v0.30.0
Checks the headers in the TRP request are correct and valid and that the core TRP protocol requirements are met before passing the request to the handler.
func TRPInfo ¶ added in v0.30.0
Get the TRP info from the context as set by the VerifyTRPCore middleware.
func VerifyTRPCore ¶ added in v0.30.0
VerifyTRPCore checks the request identifier and content type match the core TRP protocol. NOTE that all core TRP requests must be POST requests with JSON content type.
Types ¶
type Server ¶
func Debug ¶
func Debug(conf config.Config, store store.Store, network network.Network, srv *http.Server) (s *Server, err error)
Debug returns a server that uses the specified http server instead of creating one. This function is primarily used to create test servers easily.
func (*Server) Confirmation ¶ added in v0.30.0
func (*Server) Maintenance ¶
func (s *Server) Maintenance() gin.HandlerFunc
If the server is in maintenance mode, aborts the current request and renders the maintenance mode page instead. Returns nil if not in maintenance mode.
func (*Server) NotAllowed ¶
Returns a method not allowed JSON response
func (*Server) SetStatus ¶
SetStatus sets the health and ready status on the server, modifying the behavior of the kubernetes probe responses.
func (*Server) TRPExtensions ¶ added in v0.24.1
Implementation of the Discoverability Extension: returns supported and required extensions. See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/extensions/discoverability.md
func (*Server) TRPVersion ¶ added in v0.24.1
Implementation of the Discoverability Extension: returns the version and vendor. See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/extensions/discoverability.md
func (*Server) URL ¶
URL returns the endpoint of the server as determined by the configuration and the socket address and port (if specified).
func (*Server) Uptime ¶ added in v0.24.1
Implementation of the Discoverability Extension: returns the uptime in number of seconds See: https://gitlab.com/OpenVASP/travel-rule-protocol/-/blob/master/extensions/discoverability.md