mirror of
https://github.com/sartoopjj/thefeed.git
synced 2026-05-19 07:54:36 +03:00
remove dead code and change retry count for client
This commit is contained in:
@@ -23,3 +23,5 @@ session.json
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
|
||||
todo
|
||||
|
||||
+1
-1
@@ -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)")
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user