openranking

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package openranking implements the Open Ranking protocol server. Learn more: https://github.com/Open-Ranking/protocol

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Ranking ranking.Config
	Refill  credits.RefillPolicy

	Address           string        `env:"ADDRESS"`
	ReadHeaderTimeout time.Duration `env:"READ_HEADER_TIMEOUT"`
	IdleTimeout       time.Duration `env:"IDLE_TIMEOUT"`
	RequestTimeout    time.Duration `env:"REQUEST_TIMEOUT"`
	ShutdownTimeout   time.Duration `env:"SHUTDOWN_TIMEOUT"`
}

func NewConfig

func NewConfig() Config

func (Config) String

func (c Config) String() string

func (Config) Validate

func (c Config) Validate() error

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements the Open Ranking protocol.

func NewServer

func NewServer(c Config, s *ranking.Service, limiter rate.Limiter) Server

NewServer creates a new Open Ranking server.

func (Server) Capabilities

func (s Server) Capabilities(w http.ResponseWriter, r *http.Request)

Capabilities serves GET /.well-known/open-ranking.json (ORE-01).

func (Server) CompromisedPubkeys

func (s Server) CompromisedPubkeys(w http.ResponseWriter, r *http.Request)

CompromisedPubkeys serves POST /compromised/pubkeys (ORE-08).

func (Server) Followers

func (s Server) Followers(w http.ResponseWriter, r *http.Request)

Followers serves POST /followers (ORE-06).

func (Server) RankPubkeys

func (s Server) RankPubkeys(w http.ResponseWriter, r *http.Request)

RankPubkeys serves POST /rank/pubkeys (ORE-03).

func (Server) RecommendPubkeys

func (s Server) RecommendPubkeys(w http.ResponseWriter, r *http.Request)

RecommendPubkeys serves POST /recommend/pubkeys (ORE-04).

func (Server) SearchPubkeys

func (s Server) SearchPubkeys(w http.ResponseWriter, r *http.Request)

SearchPubkeys serves POST /search/pubkeys (ORE-05).

func (Server) StartAndServe

func (s Server) StartAndServe(ctx context.Context, address string) error

StartAndServe starts the Open Ranking server and serves requests. It's a blocking operation that returns only when the context is cancelled.

func (Server) StatsPubkey

func (s Server) StatsPubkey(w http.ResponseWriter, r *http.Request)

StatsPubkey serves POST /stats/pubkey (ORE-02).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL