server

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IServer

type IServer interface {
	Start() error
}

IServer to specify the Server functionalities

type Server

type Server struct {
	IServer

	// in case you call Server.Start
	Addr string

	LogAdapter adapter.LogAdapter
	// contains filtered or unexported fields
}

Server is the base for the complete implementation of our nostr relay It will handle the incoming requests and delegate it to the corresponding functionalities in the backend e.g. relay

func NewServer

func NewServer(relay *relay.Relay) *Server

func (*Server) HandleWebsocket

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

HandleWebsocket function to exract and delegate traffic from websockets.

func (*Server) InjectHandler

func (s *Server) InjectHandler(pattern string, handler http.Handler)

InjectHandler allows to inject custom http.Handlers into the server on a given path this will panic if the pattern is already registered

func (*Server) ServeHTTP

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

ServeHTTP implements http.Handler interface.

func (*Server) Start

func (s *Server) Start() error

Start is the function to start up the server and handle then delegate the handling of the traffic

Jump to

Keyboard shortcuts

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