mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-12-22 19:49:25 +00:00
Make X-Prober-Api-Key as constant
This commit is contained in:
parent
c6e0ce751e
commit
130cd06dc4
3 changed files with 5 additions and 3 deletions
|
@ -99,7 +99,7 @@ func (p *proberClient) fetchJob() (monero.Node, error) {
|
|||
if err != nil {
|
||||
return node, err
|
||||
}
|
||||
req.Header.Add("X-Prober-Api-Key", p.config.ApiKey)
|
||||
req.Header.Add(monero.ProberAPIKey, p.config.ApiKey)
|
||||
req.Header.Set("User-Agent", RPCUserAgent)
|
||||
|
||||
client := &http.Client{}
|
||||
|
@ -285,7 +285,7 @@ func (p *proberClient) reportResult(node monero.Node, tookTime float64) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
req.Header.Add("X-Prober-Api-Key", p.config.ApiKey)
|
||||
req.Header.Add(monero.ProberAPIKey, p.config.ApiKey)
|
||||
req.Header.Set("Content-Type", "application/json; charset=UTF-8")
|
||||
req.Header.Set("User-Agent", RPCUserAgent)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
func CheckProber(c *fiber.Ctx) error {
|
||||
key := c.Get("X-Prober-Api-Key")
|
||||
key := c.Get(monero.ProberAPIKey)
|
||||
if key == "" {
|
||||
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
|
||||
"status": "error",
|
||||
|
|
|
@ -9,6 +9,8 @@ import (
|
|||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const ProberAPIKey = "X-Prober-Api-Key" // HTTP header key
|
||||
|
||||
type ProberRepository interface {
|
||||
Add(name string) (Prober, error)
|
||||
Edit(id int, name string) error
|
||||
|
|
Loading…
Reference in a new issue