Documentation
¶
Overview ¶
Package tor provides Tor hidden service integration for the ORLY relay. It manages a listener on a dedicated port that receives traffic forwarded from the Tor daemon, and exposes the .onion address for NIP-11 integration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Port is the internal port that Tor forwards .onion traffic to
Port int
// HSDir is the Tor HiddenServiceDir path to read .onion hostname from
HSDir string
// OnionAddress is an optional manual override for the .onion address
OnionAddress string
// Handler is the HTTP handler to serve (typically the main relay handler)
Handler http.Handler
}
Config holds Tor hidden service configuration.
type HostnameWatcher ¶
type HostnameWatcher struct {
// contains filtered or unexported fields
}
HostnameWatcher watches the Tor hidden service hostname file for changes. When Tor creates or updates a hidden service, it writes the .onion address to a file called "hostname" in the HiddenServiceDir.
func NewHostnameWatcher ¶
func NewHostnameWatcher(hsDir string) *HostnameWatcher
NewHostnameWatcher creates a new hostname watcher for the given HiddenServiceDir.
func (*HostnameWatcher) Address ¶
func (w *HostnameWatcher) Address() string
Address returns the current .onion address.
func (*HostnameWatcher) HostnameFilePath ¶
func (w *HostnameWatcher) HostnameFilePath() string
HostnameFilePath returns the path to the hostname file.
func (*HostnameWatcher) OnChange ¶
func (w *HostnameWatcher) OnChange(fn func(string))
OnChange sets a callback function to be called when the hostname changes.
func (*HostnameWatcher) Start ¶
func (w *HostnameWatcher) Start() error
Start begins watching the hostname file.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages the Tor hidden service listener.
func New ¶
New creates a new Tor service with the given configuration.
func (*Service) IsRunning ¶
IsRunning returns whether the Tor service is currently running.
func (*Service) OnionAddress ¶
OnionAddress returns the current .onion address (without .onion suffix).
func (*Service) OnionWSAddress ¶
OnionWSAddress returns the full WebSocket URL for the hidden service. Format: ws://<address>.onion/
func (*Service) Start ¶
Start initializes the Tor listener and hostname watcher.
Source Files
¶
- hostname.go
- service.go