bunker

package
v0.52.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Unlicense Imports: 16 Imported by: 0

Documentation

Overview

Package bunker provides a NIP-46 remote signing service that listens only on the WireGuard VPN network for secure access.

Index

Constants

View Source
const (
	MethodConnect      = "connect"
	MethodGetPublicKey = "get_public_key"
	MethodSignEvent    = "sign_event"
	MethodNIP04Encrypt = "nip04_encrypt"
	MethodNIP04Decrypt = "nip04_decrypt"
	MethodNIP44Encrypt = "nip44_encrypt"
	MethodNIP44Decrypt = "nip44_decrypt"
	MethodPing         = "ping"
)

NIP-46 method names

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RelaySigner signer.I
	RelayPubkey []byte
	Netstack    *netstack.Net
	ListenAddr  string // IP:port on WireGuard network
}

Config holds bunker server configuration.

type NIP46Request

type NIP46Request struct {
	ID     string          `json:"id"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

NIP46Request represents a NIP-46 request from a client.

type NIP46Response

type NIP46Response struct {
	ID     string `json:"id"`
	Result any    `json:"result,omitempty"`
	Error  string `json:"error,omitempty"`
}

NIP46Response represents a NIP-46 response to a client.

type Server

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

Server is the NIP-46 bunker server.

func New

func New(cfg *Config) *Server

New creates a new bunker server.

func (*Server) RelayPubkeyHex

func (s *Server) RelayPubkeyHex() string

RelayPubkeyHex returns the relay's public key as hex.

func (*Server) SessionCount

func (s *Server) SessionCount() int

SessionCount returns the number of active sessions.

func (*Server) Start

func (s *Server) Start() error

Start begins listening for bunker connections on the WireGuard network.

func (*Server) Stop

func (s *Server) Stop() error

Stop shuts down the bunker server.

type Session

type Session struct {
	ID string
	// contains filtered or unexported fields
}

Session represents a NIP-46 client session.

func NewSession

func NewSession(parentCtx context.Context, conn *websocket.Conn, relaySigner signer.I, relayPubkey []byte) *Session

NewSession creates a new bunker session.

func (*Session) Handle

func (s *Session) Handle()

Handle processes messages from the client.

Source Files

  • server.go
  • session.go

Jump to

Keyboard shortcuts

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