feat: add gcore uploader

This commit is contained in:
Fu Diwei
2025-02-17 22:05:08 +08:00
parent e2a148c25f
commit ea02190ad5
5 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
package common
const BASE_URL = "https://api.gcore.com"

View File

@@ -0,0 +1,24 @@
package common
import (
"net/http"
"github.com/G-Core/gcorelabscdn-go/gcore"
)
type AuthRequestSigner struct {
apiToken string
}
var _ gcore.RequestSigner = (*AuthRequestSigner)(nil)
func NewAuthRequestSigner(apiToken string) *AuthRequestSigner {
return &AuthRequestSigner{
apiToken: apiToken,
}
}
func (s *AuthRequestSigner) Sign(req *http.Request) error {
req.Header.Set("Authorization", "APIKey "+s.apiToken)
return nil
}