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

server

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildLogger added in v1.0.1

func BuildLogger(options LogOptions, named string) (*zap.Logger, *zap.Config, error)

func CreateAuthzMigration

func CreateAuthzMigration(
	migrationName, dbConnectionString string,
	waitForDb, readTimeout, writeTimeout time.Duration,
	maxOpenConns int,
) error

func CreateMessageMigration

func CreateMessageMigration(
	migrationName, dbConnectionString string,
	waitForDb, readTimeout, writeTimeout time.Duration,
	maxOpenConns int,
) error

func CreateMlsMigration

func CreateMlsMigration(
	migrationName, dbConnectionString string,
	waitForDb, readTimeout, writeTimeout time.Duration,
	maxOpenConns int,
) error

func NewPGXDB added in v1.0.1

func NewPGXDB(dsn string, waitForDB, statementTimeout time.Duration) (*sql.DB, error)

func ValidateOptions added in v1.0.1

func ValidateOptions(options *Options) error

func WaitUntilDBReady added in v1.0.1

func WaitUntilDBReady(ctx context.Context, db *pgxpool.Pool, waitTime time.Duration) error

func WritePrivateKeyToFile

func WritePrivateKeyToFile(path string, overwrite bool) error

Types

type AuthzOptions

type AuthzOptions struct {
	DbConnectionString string        `long:"authz-db-connection-string" description:"Connection string for the authz DB"`
	ReadTimeout        time.Duration `long:"authz-read-timeout"         description:"Timeout for reading from the database" default:"10s"`
	WriteTimeout       time.Duration `long:"authz-write-timeout"        description:"Timeout for writing to the database"   default:"10s"`
}

type LogOptions added in v1.0.1

type LogOptions struct {
	LogLevel    string `` /* 183-byte string literal not displayed */
	LogEncoding string `` /* 186-byte string literal not displayed */
}

type MetricsOptions

type MetricsOptions struct {
	Enable  bool   `long:"metrics"         description:"Enable the metrics server"`
	Address string `long:"metrics-address" description:"Listening address of the metrics server"   default:"127.0.0.1"`
	Port    int    `long:"metrics-port"    description:"Listening HTTP port of the metrics server" default:"8008"`
}

MetricsOptions are settings used to start a prometheus server for obtaining useful node metrics to monitor the health of behavior of the go-waku node.

type Options

type Options struct {
	Port                   int           `` /* 166-byte string literal not displayed */
	Address                string        `` /* 168-byte string literal not displayed */
	EnableWS               bool          `          long:"ws"                       description:"Enable websockets support"`
	WSPort                 int           `` /* 166-byte string literal not displayed */
	WSAddress              string        `` /* 168-byte string literal not displayed */
	GenerateKey            bool          `          long:"generate-key"             description:"Generate private key file at path specified in --key-file"`
	NodeKey                string        `` /* 150-byte string literal not displayed */
	KeyFile                string        `` /* 170-byte string literal not displayed */
	Overwrite              bool          `` /* 130-byte string literal not displayed */
	StaticNodes            []string      `          long:"static-node"              description:"Multiaddr of peer to directly connect with. Option may be repeated"`
	KeepAlive              int           `` /* 163-byte string literal not displayed */
	CreateMessageMigration string        `` /* 161-byte string literal not displayed */
	CreateAuthzMigration   string        `` /* 161-byte string literal not displayed */
	CreateMlsMigration     string        `` /* 161-byte string literal not displayed */
	WaitForDB              time.Duration `` /* 164-byte string literal not displayed */
	Version                bool          `          long:"version"                  description:"Output binary version and exit"`
	GoProfiling            bool          `          long:"go-profiling"             description:"Enable Go profiling"`
	MetricsPeriod          time.Duration `` /* 164-byte string literal not displayed */

	Log LogOptions `group:"Logging Options"`

	API           api.Options                      `group:"API Options"              namespace:"api"`
	Authz         AuthzOptions                     `group:"Authz Options"`
	Relay         RelayOptions                     `group:"Relay Options"`
	Store         store.Options                    `group:"Store Options"            namespace:"store"`
	Metrics       MetricsOptions                   `group:"Metrics Options"`
	Tracing       TracingOptions                   `group:"DD APM Tracing Options"`
	Profiling     ProfilingOptions                 `group:"DD APM Profiling Options" namespace:"profiling"`
	MLSStore      mlsstore.StoreOptions            `group:"MLS Options"              namespace:"mls-store"`
	MLSValidation mlsvalidate.MLSValidationOptions `group:"MLS Validation Options"   namespace:"mls-validation"`
}

Options contains all the available features and settings that can be configured via flags when executing go-waku as a service.

type ProfilingOptions

type ProfilingOptions struct {
	Enable bool `long:"enable"    description:"Enable CPU and Heap profiling"`
	// Following options have more overhead
	Block     bool `long:"block"     description:"Enable block profiling"`
	Mutex     bool `long:"mutex"     description:"Enable mutex profiling"`
	Goroutine bool `long:"goroutine" description:"Enable goroutine profiling"`
}

ProfilingOptions enable DD APM Profiling.

type PruneConfig added in v1.0.1

type PruneConfig struct {
	MaxCycles      int   `long:"max-prune-cycles" description:"Maximum pruning cycles"                   default:"10"`
	BatchSize      int32 `long:"batch-size"       description:"Batch size"                               default:"10000"`
	CountDeletable bool  `long:"count-deletable"  description:"Attempt to count all deletable envelopes"`
	DryRun         bool  `long:"dry-run"          description:"Dry run mode"`
}

type PruneOptions added in v1.0.1

type PruneOptions struct {
	Log         LogOptions            `group:"Logging Options"`
	PruneConfig PruneConfig           `group:"Prune Options"   namespace:"prune"`
	MLSStore    mlsstore.StoreOptions `group:"MLS Options"     namespace:"mls-store"`
	Version     bool                  `                                              long:"version" description:"Output binary version and exit"`
}

type RelayOptions

type RelayOptions struct {
	Disable                bool     `long:"no-relay"                   description:"Disable relay protocol"`
	Topics                 []string `long:"topics"                     description:"List of topics to listen"`
	MinRelayPeersToPublish int      `long:"min-relay-peers-to-publish" description:"Minimum number of peers to publish to Relay" default:"0"`
}

type Server

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

func New

func New(ctx context.Context, log *zap.Logger, options Options) (*Server, error)

Create a new Server

func (*Server) Shutdown

func (s *Server) Shutdown()

func (*Server) WaitForShutdown

func (s *Server) WaitForShutdown()

type TracingOptions

type TracingOptions struct {
	Enable bool `long:"tracing" description:"Enable DD APM trace collection"`
}

TracingOptions are settings controlling collection of DD APM traces and error tracking.

Jump to

Keyboard shortcuts

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