-
Notifications
You must be signed in to change notification settings - Fork 1
/
definitions.go
44 lines (38 loc) · 2.21 KB
/
definitions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package server
import (
"time"
"github.com/bitcoin-sv/go-paymail"
)
// Server default values
const (
DefaultAPIVersion = "v1" // Version of API
DefaultPrefix = "https://" // Paymail specs require SSL
DefaultSenderValidation = false // If true, it requires extra sender validation
DefaultServerPort = 3000 // Port for the server
DefaultTimeout = 15 * time.Second // Default timeouts
)
// Url params
const (
PaymailAddressParamName = "paymailAddress" // Used to get actual paymail address from the request url
PubKeyParamName = "pubKey" // Used to get actual pubkey from the request url
PaymailAddressTemplate = "{alias}@{domain.tld}" // Used as a placeholder in capabilities list
PubKeyTemplate = "{pubkey}" // Used as a placeholder in capabilities list
)
// basicRoutes is the configuration for basic server routes
type basicRoutes struct {
Add404Route bool `json:"add_404_route,omitempty"`
AddHealthRoute bool `json:"add_health_route,omitempty"`
AddIndexRoute bool `json:"add_index_route,omitempty"`
AddNotAllowed bool `json:"add_not_allowed,omitempty"`
}
// RequestMetadata is the struct with extra metadata
type RequestMetadata struct {
Alias string `json:"alias,omitempty"` // Alias of the paymail
Domain string `json:"domain,omitempty"` // Domain of the request
IPAddress string `json:"ip_address,omitempty"` // IP address of the requesting user
Note string `json:"note,omitempty"` // Generic note field used for extra information
PaymentDestination *paymail.PaymentRequest `json:"payment_destination,omitempty"` // Information from the P2P Payment Destination request
RequestURI string `json:"request_uri,omitempty"` // Full requesting URL path
ResolveAddress *paymail.SenderRequest `json:"resolve_address,omitempty"` // Information from the Resolve Address request
UserAgent string `json:"user_agent,omitempty"` // User agent of the requesting user
}