mirror of
https://github.com/dalbodeule/hop-gate.git
synced 2025-12-07 20:35:44 +09:00
[fix](admin): handle bracketed IPv6 in domain normalization
- Updated `domain_validator` to strip brackets from IPv6 addresses for proper normalization when `net.SplitHostPort` fails. - Marked the Admin API integration task in `progress.md` as complete.
This commit is contained in:
@@ -43,12 +43,12 @@ func canonicalDomainForLookup(raw string) string {
|
||||
if h, _, err := net.SplitHostPort(d); err == nil && strings.TrimSpace(h) != "" {
|
||||
d = h
|
||||
} else {
|
||||
// net.SplitHostPort 가 실패했지만 콜론이 포함되어 있는 경우 (예: 잘못된 포맷),
|
||||
// IPv6 를 고려하지 않는 단순 환경에서는 마지막 콜론 기준으로 host 부분만 시도해볼 수 있습니다.
|
||||
if idx := strings.LastIndex(d, ":"); idx > 0 && !strings.Contains(d, "]") {
|
||||
if h := strings.TrimSpace(d[:idx]); h != "" {
|
||||
d = h
|
||||
}
|
||||
// [nitpick] If the input is a bracketed IPv6 address without a port (e.g., "[::1]"),
|
||||
// net.SplitHostPort fails, and the fallback above won't execute due to the ']' check.
|
||||
// For robustness, strip brackets if present. Note: normalizeDomain requires a dot,
|
||||
// so IP addresses (including IPv6) will be rejected downstream.
|
||||
if strings.HasPrefix(d, "[") && strings.HasSuffix(d, "]") {
|
||||
d = d[1 : len(d)-1]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ This document tracks implementation progress against the HopGate architecture an
|
||||
- [x] DTLS transport & handshake skeleton 구현 (server/client).
|
||||
- [x] Domain ent schema + PostgreSQL 연결 & schema init.
|
||||
- [x] DomainService 실제 구현 + DomainValidator 구현.
|
||||
- [ ] Admin API + ent + PostgreSQL 연결 (실제 도메인 등록/해제 동작).
|
||||
- [x] Admin API + ent + PostgreSQL 연결 (실제 도메인 등록/해제 동작).
|
||||
|
||||
### Milestone 2 — Full HTTP Tunneling (프락시 동작 완성)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user