Documentation ¶
Index ¶
- Constants
- Variables
- func FetchCurrentGuardianSet(rpcUrl, coreAddr string) (*common.GuardianSet, error)
- func NewHTTPServer(addr string, t *pubsub.Topic, permissions *Permissions, ...) *http.Server
- func NewStatusServer(addr string, logger *zap.Logger, env common.Environment) *statusServer
- func RunPrometheusScraper(ctx context.Context, logger *zap.Logger, info promremotew.PromTelemetryInfo) error
- type AllowedCall
- type Config
- type ErrorEntry
- type EthCall
- type EthCallByTimestamp
- type EthCallWithFinality
- type GuardianSignature
- type LoggingMap
- type P2PSub
- type PendingResponse
- type PendingResponses
- type Permissions
- type PermissionsMap
- type SignedResponse
- type SolanaAccount
- type SolanaPda
- type User
Constants ¶
const CCQ_SERVER_SIGNING_KEY = "CCQ SERVER SIGNING KEY"
const DEV_NETWORK_ID = "/wormhole/dev"
const ETH_CALL_SIG_LENGTH = 4
const MAX_BODY_SIZE = 5 * 1024 * 1024
Variables ¶
var QueryServerCmd = &cobra.Command{
Use: "query-server",
Short: "Run the cross-chain query server",
Run: runQueryServer,
}
Functions ¶
func FetchCurrentGuardianSet ¶
func FetchCurrentGuardianSet(rpcUrl, coreAddr string) (*common.GuardianSet, error)
func NewHTTPServer ¶
func NewHTTPServer(addr string, t *pubsub.Topic, permissions *Permissions, signerKey *ecdsa.PrivateKey, p *PendingResponses, logger *zap.Logger, env common.Environment, loggingMap *LoggingMap) *http.Server
func NewStatusServer ¶
func NewStatusServer(addr string, logger *zap.Logger, env common.Environment) *statusServer
func RunPrometheusScraper ¶
func RunPrometheusScraper(ctx context.Context, logger *zap.Logger, info promremotew.PromTelemetryInfo) error
Types ¶
type AllowedCall ¶
type AllowedCall struct { EthCall *EthCall `json:"ethCall"` EthCallByTimestamp *EthCallByTimestamp `json:"ethCallByTimestamp"` EthCallWithFinality *EthCallWithFinality `json:"ethCallWithFinality"` SolanaAccount *SolanaAccount `json:"solAccount"` SolanaPda *SolanaPda `json:"solPDA"` }
type ErrorEntry ¶
type ErrorEntry struct {
// contains filtered or unexported fields
}
type EthCallByTimestamp ¶
type EthCallWithFinality ¶
type GuardianSignature ¶
type LoggingMap ¶
type LoggingMap struct {
// contains filtered or unexported fields
}
LoggingMap is used to track the requests for which we should log response. It contains a map keyed by the request signature where the payload is time the request was received. Requests will be removed from the map after two minutes.
func NewLoggingMap ¶
func NewLoggingMap() *LoggingMap
NewLoggingMap creates the map used to track requests for which we should log responses.
func (*LoggingMap) AddRequest ¶
func (lm *LoggingMap) AddRequest(requestSignature string)
AddRequest adds a request to the map, giving it an expiration time two minutes into the future.
func (*LoggingMap) CleanUp ¶
func (lm *LoggingMap) CleanUp(logger *zap.Logger)
CleanUp iterates over the map and removes all entries that are more than two minutes old.
func (*LoggingMap) ShouldLogResponse ¶
func (lm *LoggingMap) ShouldLogResponse(requestSignature string) bool
ShouldLogResponse returns true if the request is in the map.
type PendingResponse ¶
type PendingResponse struct {
// contains filtered or unexported fields
}
func NewPendingResponse ¶
func NewPendingResponse(req *gossipv1.SignedQueryRequest, userName string, queryRequest *query.QueryRequest) *PendingResponse
type PendingResponses ¶
type PendingResponses struct {
// contains filtered or unexported fields
}
func NewPendingResponses ¶
func NewPendingResponses(logger *zap.Logger) *PendingResponses
func (*PendingResponses) Add ¶
func (p *PendingResponses) Add(r *PendingResponse) bool
func (*PendingResponses) Get ¶
func (p *PendingResponses) Get(signature string) *PendingResponse
func (*PendingResponses) NumPending ¶
func (p *PendingResponses) NumPending() int
func (*PendingResponses) Remove ¶
func (p *PendingResponses) Remove(r *PendingResponse)
type Permissions ¶
type Permissions struct {
// contains filtered or unexported fields
}
func NewPermissions ¶
func NewPermissions(fileName string, env common.Environment) (*Permissions, error)
NewPermissions creates a Permissions object which contains the per-user permissions.
func (*Permissions) GetUserEntry ¶
func (perms *Permissions) GetUserEntry(apiKey string) (*permissionEntry, bool)
GetUserEntry returns the permissions entry for a given API key. It uses the lock to protect against updates.
func (*Permissions) Reload ¶
func (perms *Permissions) Reload(logger *zap.Logger)
Reload reloads the permissions file.
func (*Permissions) StartWatcher ¶
StartWatcher creates an fswatcher to watch for updates to the permissions file and reload it when it changes.
func (*Permissions) StopWatcher ¶
func (perms *Permissions) StopWatcher()
StopWatcher stops the permissions file watcher.
type PermissionsMap ¶
type PermissionsMap map[string]*permissionEntry
type SignedResponse ¶
type SignedResponse struct { Response *query.QueryResponsePublication Signatures []GuardianSignature }
type SolanaAccount ¶
type User ¶
type User struct { UserName string `json:"userName"` ApiKey string `json:"apiKey"` AllowUnsigned bool `json:"allowUnsigned"` AllowAnything bool `json:"allowAnything"` RateLimit *float64 `json:"RateLimit"` BurstSize *int `json:"BurstSize"` LogResponses bool `json:"logResponses"` AllowedCalls []AllowedCall `json:"allowedCalls"` }