Skip to content

Commit 8e525dd

Browse files
committed
Merge branch 'main' into feature/landing-page
2 parents 0a60ceb + 208231e commit 8e525dd

63 files changed

Lines changed: 5232 additions & 1871 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ PORTAL_URL=https://localhost:4017
55
API_PORT=4017
66
SNI_PORT=443
77

8+
# UDP transport (0 = disabled). Set count > 0 to enable QUIC tunnel + allocate UDP ports starting from 50000.
9+
# e.g., UDP_PORT_COUNT=10 → ports 50000-50009. Also requires enabling UDP in the admin panel.
10+
UDP_PORT_COUNT=0
11+
812
# TLS/ACME and keyless materials
913
KEYLESS_DIR=./.portal-certs
1014
# Supported values: cloudflare, route53
@@ -18,6 +22,7 @@ AWS_ACCESS_KEY_ID=
1822
AWS_SECRET_ACCESS_KEY=
1923
AWS_SESSION_TOKEN=
2024
AWS_REGION=
25+
AWS_DEFAULT_REGION=
2126
AWS_HOSTED_ZONE_ID=
2227

2328
# Admin/auth configuration

AGENTS.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ Architecture, product behavior, and design rationale belong in `docs/architectur
1313

1414
## Project Principles
1515

16-
- No wrapper functions or helpers without demonstrated value.
17-
- Prefer fewer concepts and direct code over extra layers, facades, and indirection.
18-
- Prefer flattening and merging nearby responsibilities over splitting files or packages by default.
19-
- Remove dead fields, dead methods, dead config, and stale state while touching nearby code.
20-
- Avoid duplicate normalization, copying, and caching unless aliasing or trust boundaries require it.
21-
- Keep stable shared contracts, shared constants, and public paths in `types/`, not runtime state, package-local logic, or generic helpers.
16+
- When caller and callee are both local and no real boundary exists, change both directly; do not preserve local call shapes.
17+
- If a field, method, wrapper, or abstraction has no clear, current use and does not protect a real boundary, remove it immediately.
18+
- No wrapper functions or helpers unless they remove real coupling or protect a real boundary.
19+
- Prefer direct code over layers, facades, and indirection.
20+
- Prefer flattening and merging nearby responsibilities over splitting by default.
21+
- Remove dead fields, methods, config, and stale state while touching nearby code.
22+
- Do not duplicate normalization, validation, or defaulting logic; keep it in a single real owner.
2223
- Keep shared stateless transforms in `utils/`; keep stateful and domain-shaped logic with the real owner.
23-
- Resolve complexity in the lowest coherent owner and expose only the minimum necessary surface upward.
24-
- Shared runtime logic should live in one real owner and be reused, not mirrored by parallel helpers.
25-
- Prefer not preserving backward compatibility by default, but ask when breaking it may cause real downstream problems.
24+
- Keep stable shared contracts, constants, and public paths in `types/`, not in runtime or helpers.
25+
- Resolve complexity in the lowest coherent owner and expose only the minimum surface upward.
26+
- Shared runtime logic must live in one real owner and be reused, not mirrored.
2627

2728
## Verification
2829

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ GOIMPORTS_VERSION := v0.41.0
88
GOLANGCI_LINT_VERSION := v2.11.1
99
GOVULNCHECK_VERSION := v1.1.4
1010

11+
export GOTOOLCHAIN := $(GO_TOOLCHAIN_VERSION)
12+
1113
help:
1214
@echo "Available targets:"
1315
@echo " make install - Install Go developer tools used by this repo"
@@ -21,9 +23,9 @@ help:
2123
@echo " make clean - Remove build artifacts"
2224

2325
install:
24-
GOTOOLCHAIN=$(GO_TOOLCHAIN_VERSION) go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
25-
GOTOOLCHAIN=$(GO_TOOLCHAIN_VERSION) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
26-
GOTOOLCHAIN=$(GO_TOOLCHAIN_VERSION) go install golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)
26+
go install golang.org/x/tools/cmd/goimports@$(GOIMPORTS_VERSION)
27+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
28+
go install golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)
2729

2830
fmt:
2931
gofmt -w .

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Unlike other tunneling services, Portal is self-hosted and permissionless. You c
2525
- **End-to-end encryption**: Supports TLS passthrough with relay keyless certificates
2626
- **Permissionless Hosting**: Anyone can run their own Portal — no approval needed
2727
- **One-Command Setup**: Expose any local app with a single command
28+
- **UDP Relay (Experimental)**: Supports raw UDP relay use cases, but the transport model and operational behavior may still change
2829

2930
## Components
3031

cmd/demo-app/handler.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"time"
99

1010
"golang.org/x/net/websocket"
11+
12+
"github.com/gosuda/portal/v2/sdk"
1113
)
1214

1315
//go:embed static
@@ -61,3 +63,16 @@ func handleCookies(w http.ResponseWriter, r *http.Request) {
6163
"message": "4 cookies set: session_id, auth_token, csrf_token, user_pref",
6264
})
6365
}
66+
67+
func newUDPInfoHandler(exposure *sdk.Exposure) http.Handler {
68+
mux := http.NewServeMux()
69+
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
70+
w.Header().Set("Content-Type", "application/json")
71+
udpAddrs, _ := exposure.WaitDatagramReady(r.Context())
72+
_ = json.NewEncoder(w).Encode(map[string]any{
73+
"message": "demo-udp is running",
74+
"udp_addrs": udpAddrs,
75+
})
76+
})
77+
return mux
78+
}

0 commit comments

Comments
 (0)