mirror of
https://github.com/asmogo/nws.git
synced 2025-01-18 10:01:33 +00:00
remove PublicAddressBind
This commit is contained in:
parent
187ce54d12
commit
75cf34f8c8
@ -15,7 +15,7 @@ Exit node [domain names](#nws-domain-names) make private services accessible to
|
||||
### NWS main components
|
||||
|
||||
1. **Exit node**: A TCP reverse proxy that listens for incoming Nostr subscriptions and forwards the payload to your designated backend service.
|
||||
2. **Entry node**: Forwards TCP packets to the exit node using a SOCKS proxy and creates encrypted events for the exit node.
|
||||
2. **Entry node**: A SOCKS5 proxy that forwards TCP packets and creates encrypted events for the exit node.
|
||||
|
||||
<img src="nws.png" width="900"/>
|
||||
|
||||
@ -117,5 +117,5 @@ If you don't want to use the `PUBLIC_ADDRESS` feature, no further configuration
|
||||
PUBLIC_ADDRESS='<public_ip>:<port>'
|
||||
```
|
||||
|
||||
- `PUBLIC_ADDRESS`: This can be set if the entry node is publicly available. When set, the entry node will additionally bind to this address. Exit node discovery will still be done using Nostr. Once a connection is established, this public address will be used to transmit further data.
|
||||
- `PUBLIC_ADDRESS`: This can be set if the entry node is publicly available. Exit node discovery will still be done using Nostr. Once a connection is established, this public address will be used to transmit further data. (`<ip/domain>:<port>`)
|
||||
- `NOSTR_RELAYS`: A list of Nostr relays to publish events to. Used only if there is no relay data in the request.
|
||||
|
@ -10,9 +10,8 @@ import (
|
||||
)
|
||||
|
||||
type EntryConfig struct {
|
||||
NostrRelays []string `env:"NOSTR_RELAYS" envSeparator:";"`
|
||||
PublicAddress string `env:"PUBLIC_ADDRESS"`
|
||||
PublicAddressBind string `env:"PUBLIC_ADDRESS_BIND"`
|
||||
NostrRelays []string `env:"NOSTR_RELAYS" envSeparator:";"`
|
||||
PublicAddress string `env:"PUBLIC_ADDRESS"`
|
||||
}
|
||||
|
||||
type ExitConfig struct {
|
||||
|
@ -99,9 +99,14 @@ func New(conf *Config, pool *nostr.SimplePool, config *config.EntryConfig) (*Ser
|
||||
pool: pool,
|
||||
}
|
||||
if conf.entryConfig.PublicAddress != "" {
|
||||
listener, err := NewTCPListener(conf.entryConfig.PublicAddressBind)
|
||||
// parse host port
|
||||
_, port, err := net.SplitHostPort(conf.entryConfig.PublicAddress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("failed to parse public address: %w", err)
|
||||
}
|
||||
listener, err := NewTCPListener(net.JoinHostPort(net.IP{0, 0, 0, 0}.String(), port))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create tcp listener: %w", err)
|
||||
}
|
||||
go listener.Start()
|
||||
server.tcpListener = listener
|
||||
@ -114,6 +119,7 @@ func New(conf *Config, pool *nostr.SimplePool, config *config.EntryConfig) (*Ser
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
||||
func (s *Server) Configuration() (*Config, error) {
|
||||
if s.config != nil {
|
||||
return s.config, nil
|
||||
|
Loading…
Reference in New Issue
Block a user