Help us shape the future of Go! Take the 2026 Go Developer Survey

rewards

package
v1.3.99 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package rewards pkg/deployment/rewards/config.go c4-app-rewards handler. It can be used standalone (via the CLI) or embedded in the visor's port 80 gin router for integrated DMSG/skynet access.

Package rewards pkg/deployment/rewards/server.go c4-app-rewards

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWhitelisted

func IsWhitelisted(c *gin.Context, wlkeys []cipher.PubKey) bool

IsWhitelisted checks if the current request is from a whitelisted PK without blocking. Used for UI rendering (show/hide links).

func RemotePK

func RemotePK(c *gin.Context) cipher.PubKey

RemotePK returns the DMSG-authenticated source public key of the current request (from RemoteAddr), or a null key if it can't be parsed. Exported for handlers that must attribute a request to its sender — e.g. the survey-push endpoint stores a pushed survey under the sender's own PK so a visor can only write its own.

func WhitelistAuth

func WhitelistAuth(wlkeys []cipher.PubKey) gin.HandlerFunc

WhitelistAuth returns a gin middleware that checks if the remote PK (from DMSG/skynet RemoteAddr) is in the whitelist. Exported so the visor can use the same auth pattern.

Types

type Config

type Config struct {
	// StartTime is when the server started (for /health uptime).
	StartTime time.Time

	// PK and SK for DMSG client (only needed for standalone mode).
	PK cipher.PubKey
	SK cipher.SecKey

	// DmsgDisc is the DMSG discovery URL (standalone mode).
	DmsgDisc string
	// DmsgPort is the DMSG port to serve on (standalone mode).
	DmsgPort uint16
	// DmsgSessions is the number of DMSG sessions (standalone mode).
	DmsgSessions int

	// WebPort is the HTTP port (standalone mode).
	WebPort uint

	// WhitelistPKs is the list of PKs allowed to POST reward
	// transactions and access protected endpoints.
	WhitelistPKs []cipher.PubKey

	// WorkDir is the directory containing log_collection and reward
	// hist directories.
	WorkDir string

	// CanonicalDomain is the public domain name for SEO/sitemap
	// (e.g., "theskywirenetwork.net").
	CanonicalDomain string

	// HealthOnly disables all endpoints except /health.
	HealthOnly bool

	// EnsureOnlineURL is the URL to check for internet connectivity.
	EnsureOnlineURL string

	// LoginNode is the address of the login chain node.
	LoginNode string
	// SkycoinNode is the address of the skycoin node for tx broadcast.
	SkycoinNode string
	// LoginChainFlags is additional flags for login chain.
	LoginChainFlags string

	// Logger for the reward system.
	Log *logging.Logger
}

Config holds all the configuration needed to run the reward system UI.

Jump to

Keyboard shortcuts

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