Revert "move repository name"
This reverts commit 02197ead742529b292f53a7f8f2d565f11932067.
Kim committed
Oct 22, 2025 at 11:05 UTC
d34e33398f0dad0bb72f91872e6ebe40b8d4ec39
15 files changed
+73
-73
.github/workflows/ci.yml
+6
-6
@@ -43,9 +43,9 @@ jobs:
43
- name: Run goimports
44
run: |
45
go install golang.org/x/tools/cmd/goimports@latest
46
- if [ -n "$(goimports -local github.com/gosuda/dnsportal -l .)" ]; then
46
+ if [ -n "$(goimports -local github.com/gosuda/relaydns -l .)" ]; then
47
echo "Go imports are not formatted:"
48
- goimports -local github.com/gosuda/dnsportal -d .
48
+ goimports -local github.com/gosuda/relaydns -d .
49
exit 1
50
fi
51
@@ -87,13 +87,13 @@ jobs:
87
run: go mod download
88
89
- name: Build server binary
90
- run: go build -v -trimpath -o bin/dnsportal-server ./cmd/server
90
+ run: go build -v -trimpath -o bin/relaydns-server ./cmd/server
91
92
- name: Build example HTTP client
93
- run: go build -v -trimpath -o bin/dnsportal-client ./cmd/example_http_client
93
+ run: go build -v -trimpath -o bin/relaydns-client ./cmd/example_http_client
94
95
- name: Build example chat client
96
- run: go build -v -trimpath -o bin/dnsportal-chat ./cmd/example_chat
96
+ run: go build -v -trimpath -o bin/relaydns-chat ./cmd/example_chat
97
98
- name: Upload binaries
99
uses: actions/upload-artifact@v4
@@ -209,7 +209,7 @@ jobs:
209
context: .
210
file: ./Dockerfile
211
push: false
212
- tags: dnsportal-server:ci
212
+ tags: relaydns-server:ci
213
cache-from: type=gha
214
cache-to: type=gha,mode=max
215
.pre-commit-config.yaml
+1
-1
@@ -68,7 +68,7 @@ repos:
68
- id: go-build
69
name: go build
70
description: Build all Go binaries to ensure they compile
71
- entry: bash -c 'go build -trimpath -o /tmp/dnsportal-server ./cmd/server && go build -trimpath -o /tmp/dnsportal-client ./cmd/example_http_client && go build -trimpath -o /tmp/dnsportal-chat ./cmd/example_chat'
71
+ entry: bash -c 'go build -trimpath -o /tmp/relaydns-server ./cmd/server && go build -trimpath -o /tmp/relaydns-client ./cmd/example_http_client && go build -trimpath -o /tmp/relaydns-chat ./cmd/example_chat'
72
language: system
73
pass_filenames: false
74
types: [go]
CI_CD.md
+5
-5
@@ -1,6 +1,6 @@
1
# CI/CD Setup Guide
2
3
-This document describes the CI/CD infrastructure for the DNSPortal project, including pre-commit hooks, linters, formatters, sanitizers, and GitHub Actions workflows.
3
+This document describes the CI/CD infrastructure for the RelayDNS project, including pre-commit hooks, linters, formatters, sanitizers, and GitHub Actions workflows.
4
5
## Table of Contents
6
@@ -107,13 +107,13 @@ go fmt ./...
107
108
**goimports** - Organizes imports
109
```bash
110
-goimports -local github.com/gosuda/dnsportal -w .
110
+goimports -local github.com/gosuda/relaydns -w .
111
```
112
113
**gci** - Controls import order (integrated in golangci-lint)
114
- Standard library imports
115
- Third-party imports
116
-- Local imports (github.com/gosuda/dnsportal)
116
+- Local imports (github.com/gosuda/relaydns)
117
118
### Sanitizers
119
@@ -157,7 +157,7 @@ Hooks run automatically before each commit:
157
158
2. **Go checks**
159
- `go fmt ./...`
160
- - `goimports -local github.com/gosuda/dnsportal`
160
+ - `goimports -local github.com/gosuda/relaydns`
161
- `go vet ./...`
162
- `go mod tidy` (ensures go.mod is clean)
163
- `golangci-lint run`
@@ -327,7 +327,7 @@ Main linter configuration with 30+ linters enabled.
327
Key settings:
328
- Timeout: 5 minutes
329
- Go version: 1.25
330
-- Local prefix: `github.com/gosuda/dnsportal`
330
+- Local prefix: `github.com/gosuda/relaydns`
331
- Excludes test files from certain linters
332
- Excludes example code from security checks
333
Makefile
+9
-9
@@ -28,7 +28,7 @@ client-run:
28
go run ./cmd/example_http_client $(CLIENT_FLAGS)
29
30
client-build:
31
- go build -trimpath -o bin/dnsportal-client ./cmd/example_http_client
31
+ go build -trimpath -o bin/relaydns-client ./cmd/example_http_client
32
33
# ---------- Chat (local go) ----------
34
CHAT_PORT ?= 8091
@@ -43,15 +43,15 @@ chat-run:
43
go run ./cmd/example_chat $(CHAT_FLAGS)
44
45
chat-build:
46
- go build -trimpath -o bin/dnsportal-chat ./cmd/example_chat
46
+ go build -trimpath -o bin/relaydns-chat ./cmd/example_chat
47
48
# ---------- Build all binaries ----------
49
build-all: clean
50
@echo "Building all binaries..."
51
@mkdir -p bin
52
- go build -trimpath -o bin/dnsportal-server ./cmd/server
53
- go build -trimpath -o bin/dnsportal-client ./cmd/example_http_client
54
- go build -trimpath -o bin/dnsportal-chat ./cmd/example_chat
52
+ go build -trimpath -o bin/relaydns-server ./cmd/server
53
+ go build -trimpath -o bin/relaydns-client ./cmd/example_http_client
54
+ go build -trimpath -o bin/relaydns-chat ./cmd/example_chat
55
@echo "Binaries built successfully in ./bin/"
56
57
# ---------- Dev helpers ----------
@@ -60,7 +60,7 @@ fmt:
60
@command -v gofumpt >/dev/null 2>&1 || { echo "Installing gofumpt..."; go install mvdan.cc/gofumpt@latest; }
61
gofumpt -l -w .
62
@command -v goimports >/dev/null 2>&1 || { echo "Installing goimports..."; go install golang.org/x/tools/cmd/goimports@latest; }
63
- goimports -local github.com/gosuda/dnsportal -w .
63
+ goimports -local github.com/gosuda/relaydns -w .
64
65
tidy:
66
@echo "Tidying go.mod..."
@@ -152,7 +152,7 @@ clean:
152
153
# ---------- Help ----------
154
help:
155
- @echo "DNSPortal Makefile"
155
+ @echo "RelayDNS Makefile"
156
@echo ""
157
@echo "Server:"
158
@echo " make server-up # build and start relayserver (docker compose)"
@@ -161,9 +161,9 @@ help:
161
@echo ""
162
@echo "Clients (optional):"
163
@echo " make client-run # run example_http_client locally"
164
- @echo " make client-build # build example_http_client to ./bin/dnsportal-client"
164
+ @echo " make client-build # build example_http_client to ./bin/relaydns-client"
165
@echo " make chat-run # run example_chat locally (WS UI + advertiser)"
166
- @echo " make chat-build # build example_chat to ./bin/dnsportal-chat"
166
+ @echo " make chat-build # build example_chat to ./bin/relaydns-chat"
167
@echo ""
168
@echo "Build:"
169
@echo " make build-all # build all binaries (server, client, chat)"
README.md
+13
-13
@@ -1,28 +1,28 @@
1
-# DNSPortal
1
+# RelayDNS
2
> A lightweight, DNS-driven peer-to-peer proxy layer built on libp2p.
3
4
-`dnsportal` provides a minimal DNS-entry proxy that routes traffic between arbitrary nodes over **libp2p**.
4
+`relaydns` provides a minimal DNS-entry proxy that routes traffic between arbitrary nodes over **libp2p**.
5
It lets you expose and discover TCP services (like SSH, API endpoints, etc.) even behind NAT,
6
without depending on centralized reverse-proxy services.
7
8
-## Why DNSPortal?
8
+## Why RelayDNS?
9
Traditional DNS and hosting rely on centralized servers and public IPs.
10
-DNSPortal closes that gap — serving as a lightweight bridge for peer discovery and connection.
10
+RelayDNS removes that dependency — making connections open, direct, and owned by the users themselves.
11
12
-Think of it as the DNS layer for the peer-to-peer world:
13
-- It keeps discovery simple and human-readable (via DNS entries).
14
-- It connects peers that can’t directly see each other, acting as a neutral relay.
15
-- It gradually fades out once peers establish direct connectivity.
12
+This means:
13
+- No middlemen or fixed infrastructure.
14
+- Anyone can share or host freely.
15
+- Discovery remains open, but communication stays truly peer-to-peer.
16
17
-It provides a clear, DNS-driven entrypoint to your peer network —
18
-letting decentralized services stay reachable without depending on fixed infrastructure or centralized gateways.
17
+In a decentralized world, RelayDNS turns DNS from a naming system for servers into a discovery network for people —
18
+keeping coordination simple, while ownership and control stay entirely in your hands.
19
20
## Features
21
22
- **Peer-to-peer routing** over libp2p (supports hole punching, relay, pubsub)
23
- **DNS-driven entrypoint** (server acts as a lightweight coordinator)
24
- **Automatic peer advertisement** via GossipSub
25
-- **Pluggable client SDK** — embed the dnsportal client directly into your Go applications
25
+- **Pluggable client SDK** — embed the relaydns client directly into your Go applications
26
27
## Architecture Overview
28
@@ -75,7 +75,7 @@ If you run the chat client:
75
76
Install the module:
77
```bash
78
-go get github.com/gosuda/dnsportal
78
+go get github.com/gosuda/relaydns
79
```
80
81
Minimal snippet:
@@ -85,7 +85,7 @@ package main
85
import (
86
"context"
87
"time"
88
- "github.com/gosuda/dnsportal/relaydns"
88
+ "github.com/gosuda/relaydns/relaydns"
89
)
90
91
func main() {
cmd/example_chat/main.go
+4
-4
@@ -9,14 +9,14 @@ import (
9
"syscall"
10
"time"
11
12
- "github.com/gosuda/dnsportal/relaydns"
12
+ "github.com/gosuda/relaydns/relaydns"
13
"github.com/rs/zerolog/log"
14
"github.com/spf13/cobra"
15
)
16
17
var rootCmd = &cobra.Command{
18
- Use: "dnsportal-chat",
19
- Short: "DNSPortal demo chat (local HTTP backend + libp2p advertiser)",
18
+ Use: "relaydns-chat",
19
+ Short: "RelayDNS demo chat (local HTTP backend + libp2p advertiser)",
20
RunE: runChat,
21
}
22
@@ -51,7 +51,7 @@ func runChat(cmd *cobra.Command, args []string) error {
51
hub := newHub()
52
srv := serveChatHTTP(ln, flagName, hub)
53
54
- // 2) advertise over DNSPortal (HTTP tunneled via server /peer route)
54
+ // 2) advertise over RelayDNS (HTTP tunneled via server /peer route)
55
client, err := relaydns.NewClient(ctx, relaydns.ClientConfig{
56
Name: flagName,
57
TargetTCP: relaydns.AddrToTarget(fmt.Sprintf(":%d", flagPort)),
cmd/example_chat/view.go
+6
-6
@@ -162,7 +162,7 @@ var indexTmpl = template.Must(template.New("chat").Parse(`<!DOCTYPE html>
162
<head>
163
<meta charset="utf-8" />
164
<meta name="viewport" content="width=device-width, initial-scale=1" />
165
- <title>DNSPortal Chat — {{.Name}}</title>
165
+ <title>RelayDNS Chat — {{.Name}}</title>
166
<style>
167
:root{
168
--bg: #0d1117;
@@ -203,7 +203,7 @@ var indexTmpl = template.Must(template.New("chat").Parse(`<!DOCTYPE html>
203
<div class="term">
204
<div class="termbar">
205
<div class="dots"><span class="dot red"></span><span class="dot yellow"></span><span class="dot green"></span></div>
206
- <div style="opacity:.9">relaychat@dnsportal</div>
206
+ <div style="opacity:.9">relaychat@relaydns</div>
207
<div class="nick">
208
<label for="user" style="color:var(--muted)">nick</label>
209
<input id="user" type="text" placeholder="anon" />
@@ -240,18 +240,18 @@ var indexTmpl = template.Must(template.New("chat").Parse(`<!DOCTYPE html>
240
}
241
// Restore nickname or initialize randomly
242
let savedNick = null;
243
- try { savedNick = localStorage.getItem('dnsportal_nick'); } catch(_) {}
243
+ try { savedNick = localStorage.getItem('relaydns_nick'); } catch(_) {}
244
if(savedNick){
245
user.value = savedNick;
246
} else {
247
user.value = randomNick();
248
- try { localStorage.setItem('dnsportal_nick', user.value); } catch(_) {}
248
+ try { localStorage.setItem('relaydns_nick', user.value); } catch(_) {}
249
}
250
setPrompt();
251
- user.addEventListener('input', () => { try{ localStorage.setItem('dnsportal_nick', user.value); }catch(_){}; setPrompt(); });
251
+ user.addEventListener('input', () => { try{ localStorage.setItem('relaydns_nick', user.value); }catch(_){}; setPrompt(); });
252
roll.addEventListener('click', () => {
253
user.value = randomNick();
254
- try{ localStorage.setItem('dnsportal_nick', user.value); }catch(_){}
254
+ try{ localStorage.setItem('relaydns_nick', user.value); }catch(_){}
255
setPrompt();
256
user.focus();
257
});
cmd/example_http_client/main.go
+3
-3
@@ -10,14 +10,14 @@ import (
10
"syscall"
11
"time"
12
13
- "github.com/gosuda/dnsportal/relaydns"
13
+ "github.com/gosuda/relaydns/relaydns"
14
"github.com/rs/zerolog/log"
15
"github.com/spf13/cobra"
16
)
17
18
var rootCmd = &cobra.Command{
19
- Use: "dnsportal-client",
20
- Short: "DNSPortal demo client (local HTTP backend + libp2p advertiser)",
19
+ Use: "relaydns-client",
20
+ Short: "RelayDNS demo client (local HTTP backend + libp2p advertiser)",
21
RunE: runClient,
22
}
23
cmd/example_http_client/view.go
+3
-3
@@ -56,7 +56,7 @@ var clientPage = template.Must(template.New("index").Parse(`<!DOCTYPE html>
56
<html lang="en">
57
<head>
58
<meta charset="UTF-8">
59
- <title>DNSPortal Backend</title>
59
+ <title>RelayDNS Backend</title>
60
<style>
61
body { font-family: sans-serif; background: #f9f9f9; padding: 40px; }
62
h1 { color: #333; }
@@ -71,12 +71,12 @@ var clientPage = template.Must(template.New("index").Parse(`<!DOCTYPE html>
71
</head>
72
<body>
73
<div class="card">
74
- <h1>🚀 DNSPortal Backend</h1>
74
+ <h1>🚀 RelayDNS Backend</h1>
75
<p>This page is served from the backend node.</p>
76
<p>Current time: <b>{{.Now}}</b></p>
77
<p>Name: <b>{{.Name}}</b></p>
78
<p>Server Status: <span class="stat {{.StatusClass}}"><span class="dot"></span>{{.Status}}</span></p>
79
</div>
80
- <footer>dnsportal demo client — served locally at {{.Addr}}</footer>
80
+ <footer>relaydns demo client — served locally at {{.Addr}}</footer>
81
</body>
82
</html>`))
cmd/server/main.go
+1
-1
@@ -10,7 +10,7 @@ import (
10
"syscall"
11
"time"
12
13
- "github.com/gosuda/dnsportal/relaydns"
13
+ "github.com/gosuda/relaydns/relaydns"
14
"github.com/rs/zerolog/log"
15
"github.com/spf13/cobra"
16
)
cmd/server/view.go
+3
-3
@@ -9,7 +9,7 @@ import (
9
"strings"
10
"time"
11
12
- "github.com/gosuda/dnsportal/relaydns"
12
+ "github.com/gosuda/relaydns/relaydns"
13
"github.com/libp2p/go-libp2p/core/host"
14
"github.com/rs/zerolog/log"
15
)
@@ -127,7 +127,7 @@ var adminIndexTmpl = template.Must(template.New("admin-index").Parse(`<!doctype
127
<head>
128
<meta charset="utf-8"/>
129
<meta name="viewport" content="width=device-width, initial-scale=1" />
130
- <title>DNSPortal — Admin</title>
130
+ <title>RelayDNS — Admin</title>
131
<style>
132
* { box-sizing: border-box }
133
:root {
@@ -156,7 +156,7 @@ var adminIndexTmpl = template.Must(template.New("admin-index").Parse(`<!doctype
156
<body>
157
<div class="wrap">
158
<header>
159
- <div class="brand">DNSPortal</div>
159
+ <div class="brand">RelayDNS</div>
160
<div class="status">Admin</div>
161
</header>
162
<main>
docker-compose.yml
+1
-1
@@ -5,7 +5,7 @@ services:
5
build:
6
context: .
7
dockerfile: Dockerfile
8
- image: dreamcacao/dnsportal:latest
8
+ image: dreamcacao/relaydns:latest
9
command:
10
- "--http-port"
11
- "19080"
go.mod
+1
-1
@@ -1,4 +1,4 @@
1
-module github.com/gosuda/dnsportal
1
+module github.com/gosuda/relaydns
2
3
go 1.25.0
4
relaydns/client.go
+15
-15
@@ -25,9 +25,9 @@ type ClientConfig struct {
25
PreferQUIC bool
26
PreferLocal bool
27
28
- // libp2p stream protocol id (e.g. "/dnsportal/ssh/1.0")
28
+ // libp2p stream protocol id (e.g. "/relaydns/ssh/1.0")
29
Protocol string
30
- // pubsub topic for backend adverts (e.g. "dnsportal.backends")
30
+ // pubsub topic for backend adverts (e.g. "relaydns.backends")
31
Topic string
32
// advertise interval
33
AdvertiseEvery time.Duration
@@ -69,13 +69,13 @@ const (
69
70
// applyDefaults fills zero-values in cfg with sane defaults.
71
func applyDefaults(cfg ClientConfig) ClientConfig {
72
- if cfg.AdvertiseEvery <= 0 {
73
- cfg.AdvertiseEvery = defaultAdvertiseEvery
74
- }
75
- if cfg.AdvertiseTTL <= 0 {
76
- // Reduce default TTL from 50s to 15s (3x default advertise interval)
77
- cfg.AdvertiseTTL = 3 * cfg.AdvertiseEvery
78
- }
72
+ if cfg.AdvertiseEvery <= 0 {
73
+ cfg.AdvertiseEvery = defaultAdvertiseEvery
74
+ }
75
+ if cfg.AdvertiseTTL <= 0 {
76
+ // Reduce default TTL from 50s to 15s (3x default advertise interval)
77
+ cfg.AdvertiseTTL = 3 * cfg.AdvertiseEvery
78
+ }
79
if cfg.HTTPTimeout <= 0 {
80
cfg.HTTPTimeout = defaultHTTPTimeout
81
}
@@ -134,7 +134,7 @@ func (b *RelayClient) Start(ctx context.Context) error {
134
}
135
}
136
} else {
137
- log.Warn().Msg("dnsportal: no bootstrap sources provided (Bootstraps/ServerURL); discovery may fail")
137
+ log.Warn().Msg("relaydns: no bootstrap sources provided (Bootstraps/ServerURL); discovery may fail")
138
}
139
140
// 2) stream handler for inbound libp2p streams
@@ -205,7 +205,7 @@ func (b *RelayClient) resolveBootstraps() []string {
205
if b.cfg.ServerURL != "" {
206
if addrs, err := fetchMultiaddrsFromHosts(b.cfg.ServerURL, b.cfg.HTTPTimeout); err != nil {
207
b.setServerHealthy(false)
208
- log.Warn().Err(err).Msgf("dnsportal: fetch /hosts from %s failed", b.cfg.ServerURL)
208
+ log.Warn().Err(err).Msgf("relaydns: fetch /hosts from %s failed", b.cfg.ServerURL)
209
} else {
210
// Do not mark healthy yet; only after verifying libp2p connectivity
211
sortMultiaddrs(addrs, b.cfg.PreferQUIC, b.cfg.PreferLocal)
@@ -224,17 +224,17 @@ func (b *RelayClient) setupStreamHandler() error {
224
b.h.SetStreamHandler(b.protoID, func(s network.Stream) {
225
defer func() {
226
if err := s.Close(); err != nil {
227
- log.Debug().Err(err).Msg("dnsportal: stream close")
227
+ log.Debug().Err(err).Msg("relaydns: stream close")
228
}
229
}()
230
c, err := net.Dial("tcp", b.cfg.TargetTCP)
231
if err != nil {
232
- log.Error().Err(err).Msgf("dnsportal: dial %s", b.cfg.TargetTCP)
232
+ log.Error().Err(err).Msgf("relaydns: dial %s", b.cfg.TargetTCP)
233
return
234
}
235
defer func() {
236
if err := c.Close(); err != nil {
237
- log.Debug().Err(err).Msg("dnsportal: conn close")
237
+ log.Debug().Err(err).Msg("relaydns: conn close")
238
}
239
}()
240
// raw byte pipe (bidirectional)
@@ -244,7 +244,7 @@ func (b *RelayClient) setupStreamHandler() error {
244
_, _ = io.Copy(s, c)
245
})
246
default:
247
- return fmt.Errorf("dnsportal: either Handler or TargetTCP must be set")
247
+ return fmt.Errorf("relaydns: either Handler or TargetTCP must be set")
248
}
249
return nil
250
}
relaydns/types.go
+2
-2
@@ -8,8 +8,8 @@ import (
8
9
// Defaults shared by server and client.
10
const (
11
- DefaultProtocol = "/dnsportal/http/1.0"
12
- DefaultTopic = "dnsportal.backends"
11
+ DefaultProtocol = "/relaydns/http/1.0"
12
+ DefaultTopic = "relaydns.backends"
13
)
14
15
type Hosts struct {