remove dead code and change retry count for client

This commit is contained in:
Sarto
2026-03-28 03:41:06 +03:30
parent 266d8faf2d
commit 5988c5bc1e
4 changed files with 4 additions and 21 deletions
+2
View File
@@ -23,3 +23,5 @@ session.json
# Environment files
.env
todo
+1 -1
View File
@@ -21,7 +21,7 @@ import (
func main() {
dataDir := flag.String("data-dir", "./data", "Data directory for channels, session, and config")
listen := flag.String("listen", ":5300", "DNS listen address (host:port)")
listen := flag.String("listen", ":53", "DNS listen address (host:port)")
domain := flag.String("domain", "", "DNS domain (e.g., t.example.com)")
key := flag.String("key", "", "Encryption passphrase")
channelsFile := flag.String("channels", "", "Path to channels file (default: {data-dir}/channels.txt)")
+1 -1
View File
@@ -245,7 +245,7 @@ func (f *Fetcher) rateWait(ctx context.Context) error {
// It enqueues through the rate limiter and respects ctx cancellation.
// On transient failure it retries up to 2 additional times with a short back-off.
func (f *Fetcher) FetchBlock(ctx context.Context, channel, block uint16) ([]byte, error) {
const maxAttempts = 6
const maxAttempts = 10
var lastErr error
for attempt := 0; attempt < maxAttempts; attempt++ {
if attempt > 0 {
-19
View File
@@ -81,25 +81,6 @@ func EncodeQuery(queryKey [KeySize]byte, channel, block uint16, domain string, m
}
}
func splitLabel(s string, size int) []string {
if size <= 0 {
size = maxDNSLabelLen
}
if size > maxDNSLabelLen {
size = maxDNSLabelLen
}
parts := make([]string, 0, (len(s)+size-1)/size)
for len(s) > size {
parts = append(parts, s[:size])
s = s[size:]
}
if len(s) > 0 {
parts = append(parts, s)
}
return parts
}
// splitMultiLabel splits a hex string into two labels of randomised, unequal length.
// The first label is between 12 and (len-4) chars so the second is at least 4 chars.
// This makes query labels look less uniform across requests.