]> Sergey Matveev's repositories - tofuproxy.git/commitdiff
Modern rand.Read never fails master
authorSergey Matveev <stargrave@stargrave.org>
Fri, 14 Feb 2025 07:36:10 +0000 (10:36 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 14 Feb 2025 07:36:10 +0000 (10:36 +0300)
49 files changed:
caches/caches.go
cmd/certgen/main.go
cmd/danechk/main.go
cmd/tofuproxy/main.go
cmd/ungzip/main.go
cmd/warc-extract/main.go
conn.go
doc/download.texi
doc/index.texi
doc/integrity.texi
doc/why.texi
fifos/add.go
fifos/del.go
fifos/list.go
fifos/log.go
fifos/restricted.go
fifos/spies.go
fifos/start.go
fifos/tls.go
fifos/warcs.go
go.mod
go.sum
httpauth.go
makedist
rounds/denyFonts.go
rounds/gemini.go
rounds/habrImage.go
rounds/reddit.go
rounds/redirectHTML.go
rounds/spy.go
rounds/transcodeAVIF.go
rounds/transcodeJXL.go
rounds/transcodeWebP.go
rounds/warc.go
tls.go
tls/dane.go
tls/dial.go
tls/tlsauth.go
tls/verify.go
trip.go
warc/compressed.go
warc/gzip.go
warc/header.go
warc/open.go
warc/reader.go
warc/record.go
warc/uncompressed.go
warc/uris.go
x509.go

index 81449349fac68479c2e89db80bbc72013239bc24..3d802d0f4da3f6db309e147287174b648acc24fc 100644 (file)
@@ -21,6 +21,6 @@ var (
        Spies  = make([]string, 0)
        SpiesM sync.RWMutex
 
-       Restricted = make(map[string][]string)
+       Restricted  = make(map[string][]string)
        RestrictedM sync.RWMutex
 )
index 5e66a5957971212eb5697f2041c4f64a882b5d98..d37c341315754359df5dddb468f6eb33f020c8c3 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@ import (
        "crypto/x509/pkix"
        "encoding/pem"
        "flag"
-       "io"
        "log"
        "math/big"
        "os"
@@ -42,9 +41,7 @@ func main() {
        notAfter := notBefore.Add(365 * 24 * time.Hour)
 
        serialRaw := make([]byte, 16)
-       if _, err := io.ReadFull(rand.Reader, serialRaw); err != nil {
-               log.Fatalln(err)
-       }
+       rand.Read(serialRaw)
        serial := big.NewInt(0)
        serial = serial.SetBytes(serialRaw)
 
index b4dda425d7136d475967c420654e5b4a249cb74e..b528360d5aab2c9dbf8c1b7f9e488b1c0e1abb41 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ import (
        "fmt"
        "log"
 
-       "go.cypherpunks.ru/ucspi"
+       "go.cypherpunks.su/ucspi/v2"
        ttls "go.stargrave.org/tofuproxy/tls"
 )
 
index 625535d527536b627b150da78e65c479c06a5619..f93884511999a32e41124447ede92d9c27fca20f 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ import (
        "net"
        "net/http"
 
-       "go.cypherpunks.ru/ucspi"
+       "go.cypherpunks.su/ucspi/v2"
        "go.stargrave.org/tofuproxy"
        "go.stargrave.org/tofuproxy/fifos"
        "go.stargrave.org/tofuproxy/rounds"
index 064ddc304d94855fdc345d758c8e4df0a66a5a95..91f962f57abae762d3de591e0cb0319bfe47e052 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index c9d2a3676b9c21938a6e1b4861c30da5eb66ce09..3280c1331e22e5e68d3f5b27d9160185322fe14f 100644 (file)
@@ -1,5 +1,5 @@
 // warc-extract -- WARC files data extractor
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
diff --git a/conn.go b/conn.go
index 9e9ce1c5c70a39a2ff2f4cef2508020e7e4538e7..7fcff649c6bbefd5eea7a2ab3a5ae9d921f48b3d 100644 (file)
--- a/conn.go
+++ b/conn.go
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index dd5bb5d2643ef8b5302bcd55ab90cc6193c15208..64845135f9d53b393c295628d611384cf6ee80b2 100644 (file)
@@ -1,6 +1,12 @@
 @multitable {XXXXX} {XXXX-XX-XX} {XXXX KiB} {meta4 tar pgp ssh}
 @headitem Version @tab Date @tab Size @tab Tarball
 
+@item 0.6.0 @tab 2024-04-21 @tab 651 KiB @tab
+    @url{download/tofuproxy-0.6.0.tar.zst.meta4, meta4}
+    @url{download/tofuproxy-0.6.0.tar.zst, tar}
+    @url{download/tofuproxy-0.6.0.tar.zst.asc, pgp}
+    @url{download/tofuproxy-0.6.0.tar.zst.sig, ssh}
+
 @item 0.5.0 @tab 2024-04-18 @tab 651 KiB @tab
     @url{download/tofuproxy-0.5.0.tar.zst.meta4, meta4}
     @url{download/tofuproxy-0.5.0.tar.zst, tar}
index de9d845b2851a6e04a2ea900c9a96a3ca8549d48..4e8fefd9c22463b524c38d38a8112a9e4ec43ded 100644 (file)
@@ -2,7 +2,7 @@
 @settitle tofuproxy
 
 @copying
-Copyright @copyright{} 2021-2024 @email{stargrave@@stargrave.org, Sergey Matveev}
+Copyright @copyright{} 2021-2025 @email{stargrave@@stargrave.org, Sergey Matveev}
 @end copying
 
 @node Top
@@ -21,7 +21,7 @@ capabilities:
 @item
 Full TLS connection termination between Web-servers and
 @command{tofuproxy} itself. TLS 1.3, session resumption, GOST
-cryptography (if built with @url{http://www.gostls13.cypherpunks.ru/,
+cryptography (if built with @url{http://www.gostls13.cypherpunks.su/,
 gostls13}) support. Connection between @command{tofuproxy} and browser
 itself uses ephemeral on-the-fly generated certificates with proper
 domain name.
@@ -55,11 +55,10 @@ input dialogue is shown. It automatically loads initial form values from
 @file{.netrc}.
 
 @item
-Permanent HTTP redirects are replaces with non-refreshing HTML page with
+Permanent HTTP redirects are replaced with non-refreshing HTML page with
 the link, to make you explicitly allow that step. Temporary redirects
-are followed if it is neither @url{https://newsboat.org/, Newsboat}
-nor @url{https://www.feeder.stargrave.org/, go.stargrave.org/feeder}
-user-agent, not image paths.
+are followed if it is neither @url{https://www.feeder.stargrave.org/, go.stargrave.org/feeder}
+user-agent, nor image paths.
 
 @item
 JPEG XL, AVIF and WebP images are transparently transcoded to PNG,
index f44863afd124f7420b9d870dad909b2ea2c801d7..84efb55a2fd8911b014400d6b3c4b97d6b71294d 100644 (file)
@@ -27,7 +27,7 @@ $ gpg --auto-key-locate  wkd --locate-keys tofuproxy at stargrave dot org
     Its fingerprint: @code{SHA256:NIDt9iZUizwivY3GoxmGvbQTH7mz/dmV7ZFOXeYfa2o}.
 
 @example
-$ ssh-keygen -Y verify -f PUBKEY-SSH.pub -I tofuproxy@@cypherpunks.ru -n file \
+$ ssh-keygen -Y verify -f PUBKEY-SSH.pub -I tofuproxy@@stargrave.org -n file \
     -s tofuproxy-@value{VERSION}.tar.zst.sig <tofuproxy-@value{VERSION}.tar.zst
 @end example
 
index 7e8aa24bb163a9b2d8527f4400091105eaa5e1ff..0b61ae5133db4582a1e315e1038423d82f974954 100644 (file)
@@ -10,10 +10,7 @@ OpenSSL... All of them sucks, comparing to Go's @code{crypto/tls}.
 @item I am tired that everyone provides very limited certificates trust
 management capabilities, like either certificate or SPKI
 @url{https://en.wikipedia.org/wiki/Certificate_pinning, pinning} with
-@url{https://en.wikipedia.org/wiki/Trust_on_first_use, TOFU}. Even my
-beloved @url{https://en.wikipedia.org/wiki/Xombrero, Xombrero} browser
-still pins only the whole certificate, but its public key would be much
-more sufficient and convenient to work with.
+@url{https://en.wikipedia.org/wiki/Trust_on_first_use, TOFU}.
 
 @item I am tired that many clients provides very few information about
 certificates and connections at all.
@@ -27,8 +24,6 @@ kind of @url{https://en.wikipedia.org/wiki/Privoxy, Privoxy}, but it is
 not friendly with TLS connections, obviously. Or use yet another
 browser-specific plugin.
 
-@item Xombrero sometimes has problems with HTTP-based authorization.
-
 @item Hardly anyone does
 @url{https://en.wikipedia.org/wiki/DNS-based_Authentication_of_Named_Entities, DANE}
 checks.
@@ -37,11 +32,9 @@ checks.
 Why the hell people just do not send PostScript documents instead!?
 
 @item And wonderful @url{http://jpegxl.info/, JPEG XL} image format is
-not supported by most browsers. Even pretty old
-@url{https://developers.google.com/speed/webp, WebP}, that has highest
-compression ratio for lossless screenshots, is not supported everywhere,
-especially on old browsers.
-@url{https://aomediacodec.github.io/av1-avif/, AVIF} could be useful too.
+not supported by all browsers. Even pretty old
+@url{https://developers.google.com/speed/webp, WebP}, is not supported
+everywhere, especially on old browsers.
 
 @item None of web browsers has ability to view web archives
 (@url{https://en.wikipedia.org/wiki/Web_ARChive, WARC}s). And most of
index cf8f3fdc2ff57a9adc3db893b57970dc98d7fa69..e57323da8071b69a32f20ab1ac5324002b394a9f 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import (
 )
 
 func readLinesFromFIFO(p string) []string {
-       fd, err := os.OpenFile(p, os.O_RDONLY, os.FileMode(0666))
+       fd, err := os.OpenFile(p, os.O_RDONLY, os.FileMode(0o666))
        if err != nil {
                log.Fatalln(err)
        }
index a1923023a969f57a9013bcc5d920725c30e36057..85b15fadc49673691efae158eee737ab01ba672a 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ import (
 
 func del(l *sync.RWMutex, deleter func(string), p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_RDONLY, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_RDONLY, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
index f571d04c067c9db36afc0a5ae5f9d2750ba78399..81da523fd6fa06e63d2c8b9fb4aa2f0d086f0b36 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ import (
 
 func list(l *sync.RWMutex, m map[string]string, p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
@@ -53,7 +53,7 @@ func listRejected(p string) {
 
 func listHTTPAuth(p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
@@ -70,15 +70,16 @@ func listHTTPAuth(p string) {
 
 func listTLSAuth(p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
                caches.TLSAuthCacheM.RLock()
+               var cert *x509.Certificate
                for host, tlsCert := range caches.TLSAuthCache {
                        subj := "NONE"
                        if len(tlsCert.Certificate) != 0 {
-                               cert, err := x509.ParseCertificate(tlsCert.Certificate[0])
+                               cert, err = x509.ParseCertificate(tlsCert.Certificate[0])
                                if err != nil {
                                        log.Fatalln(err)
                                }
index 6cdb87d948f47fee0c562ed27265e20750d4be42..1c61a34a14442a048a7db8c55df54e84dc0e622f 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ import (
        "os"
        "time"
 
-       "go.cypherpunks.ru/tai64n/v2"
+       "go.cypherpunks.su/tai64n/v4"
 )
 
 var (
@@ -42,9 +42,9 @@ var (
 )
 
 func logger(c chan string, p string) {
-       tai := new(tai64n.TAI64N)
+       var tai tai64n.TAI64N
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
@@ -53,7 +53,7 @@ func logger(c chan string, p string) {
                                _, err = fd.WriteString(s + "\n")
                        } else {
                                tai.FromTime(time.Now())
-                               _, err = fd.WriteString(tai64n.Encode(tai[:]) + " " + s + "\n")
+                               _, err = fd.WriteString(tai.Encode() + " " + s + "\n")
                        }
                        if err != nil {
                                break
index 6b8c319537c0d809c9681ee3fdafe7c77849ca4c..68989244c530b9a78e198f0afec1c9f8589c0714 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ import (
 
 func listRestricted(p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
index d0fa4a9cd73c5befa4e163d96c0816a223fa8b9c..5e122ead5a11dbaa0055d2a480e0d7daa221f5bf 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ import (
 
 func listSpies(p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
index c904a91b3fc927da0e46c458148aacc793dace28..582743684612e45136b7e589e60056c32c32074e 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 01a70600e7a4e676f3f8589e59c343848f7669fc..8c783c1d9ca60d8690e517b6e5f211edf2b25f0b 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ import (
        "log"
        "strings"
 
-       "go.cypherpunks.ru/ucspi"
+       "go.cypherpunks.su/ucspi/v2"
        "go.stargrave.org/tofuproxy/caches"
 )
 
index 54f86a5b72d6900f513e9da1bf3fe6a7742c8e4c..22976f2f42b79079319accaeed4fe626724a3be7 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import (
 
 func listWARCs(p string) {
        for {
-               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0666))
+               fd, err := os.OpenFile(p, os.O_WRONLY|os.O_APPEND, os.FileMode(0o666))
                if err != nil {
                        log.Fatalln(err)
                }
diff --git a/go.mod b/go.mod
index e1299a03baee94df1ac5a034ea684b815a462634..330412ece0fd8166f54e7c9a042cc8ca3bc909ac 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -1,18 +1,19 @@
 module go.stargrave.org/tofuproxy
 
-go 1.21
+go 1.24
 
 require (
        github.com/dustin/go-humanize v1.0.1
-       github.com/miekg/dns v1.1.57
-       go.cypherpunks.ru/netrc v0.1.0
-       go.cypherpunks.ru/tai64n/v2 v2.0.1
-       go.cypherpunks.ru/ucspi v0.1.0
+       github.com/miekg/dns v1.1.63
+       go.cypherpunks.su/netrc/v2 v2.0.0
+       go.cypherpunks.su/tai64n/v4 v4.1.0
+       go.cypherpunks.su/ucspi/v2 v2.0.0
 )
 
 require (
-       golang.org/x/mod v0.14.0 // indirect
-       golang.org/x/net v0.19.0 // indirect
-       golang.org/x/sys v0.15.0 // indirect
-       golang.org/x/tools v0.16.0 // indirect
+       golang.org/x/mod v0.23.0 // indirect
+       golang.org/x/net v0.35.0 // indirect
+       golang.org/x/sync v0.11.0 // indirect
+       golang.org/x/sys v0.30.0 // indirect
+       golang.org/x/tools v0.30.0 // indirect
 )
diff --git a/go.sum b/go.sum
index d0930babda48948f5ae08591456047ff7a2181d1..fdf7dc4bb451499456a6e88ae142352e67ca15fa 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1,20 +1,22 @@
 github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
 github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
-github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
-github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
-go.cypherpunks.ru/netrc v0.1.0 h1:dzaSh4lgpPXvLzUME/hTSegg+Uw1aPEmC79fxbPLFGk=
-go.cypherpunks.ru/netrc v0.1.0/go.mod h1:ZmQaL9ENEII++WQooelccr33XZcBhKd8VgtcICf4SIE=
-go.cypherpunks.ru/tai64n/v2 v2.0.1 h1:AnwUUgi0EixZcr6nzjUaOy2DFInFwbNRkBkgon4oJfU=
-go.cypherpunks.ru/tai64n/v2 v2.0.1/go.mod h1:Jlva0YVJBpaRFAJ4jfY4BXVPuav0GMyGXzYPSKCCCL0=
-go.cypherpunks.ru/ucspi v0.1.0 h1:1w0E1mSf5oo3ozSSRUZN8Mf4/Ba18S3q7c5CDeCuHZA=
-go.cypherpunks.ru/ucspi v0.1.0/go.mod h1:mrkWllR0o0B/BocrUAL4DhcKLPK6XycObSswHUL5m6s=
-golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
-golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
-golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
-golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
-golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
-golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
-golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
-golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/miekg/dns v1.1.63 h1:8M5aAw6OMZfFXTT7K5V0Eu5YiiL8l7nUAkyN6C9YwaY=
+github.com/miekg/dns v1.1.63/go.mod h1:6NGHfjhpmr5lt3XPLuyfDJi5AXbNIPM9PY6H6sF1Nfs=
+go.cypherpunks.su/netrc/v2 v2.0.0 h1:IWJ0fPcQoccn8VbqzAQf1/4rj8zw0Bf6X5kAkzwEd48=
+go.cypherpunks.su/netrc/v2 v2.0.0/go.mod h1:F5Ea8ii3R9dNUE0ixE61OYIhvJQVLLdIJjrU/3qROjw=
+go.cypherpunks.su/tai64n/v4 v4.1.0 h1:jW0EyklKXpSy9DSFMcDbu7XuLlMkn6kkpNWiMG6UT5c=
+go.cypherpunks.su/tai64n/v4 v4.1.0/go.mod h1:/uKUdhLOy8UciRKpapPaFXSOoa/SiXjs3XsDDpAz7OA=
+go.cypherpunks.su/ucspi/v2 v2.0.0 h1:Ha/0xfi0nXL/4xdiXqKbHdbXWE/qKcnXux4hG7c/lwM=
+go.cypherpunks.su/ucspi/v2 v2.0.0/go.mod h1:GIIOgXFLLze7hG1sAmXmPNTopVrAaFi5m+GMUA72fXY=
+golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
+golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
+golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
+golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
+golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
+golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
+golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
+golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
index 8e324528306d630edc11ca60723dcf0665db3327..06b1576d182f73704dbcd0a71a5a2a44920ab65e 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import (
        "os/exec"
        "strings"
 
-       "go.cypherpunks.ru/netrc"
+       "go.cypherpunks.su/netrc/v2"
        ttls "go.stargrave.org/tofuproxy/tls"
 )
 
@@ -31,7 +31,6 @@ func authDialog(host, realm string) (string, string, error) {
        var b bytes.Buffer
        userInit, passInit := netrc.Find(host)
        fmt.Fprintf(&b, `
-tk_setPalette grey
 wm title . "Unauthorized: %s"
 
 label .luser -text "User"
index 3df55082e9a917ccf73b31eb5bdb775688a16c55..002b3e2b711bfa9aaca5f42f9bad1930db8ea2ad 100755 (executable)
--- a/makedist
+++ b/makedist
@@ -54,7 +54,7 @@ find . -type f -exec chmod 644 {} +
 chmod +x build state-init fifos/ensure fifos/multitail cmd/zstd/build
 
 cd ..
-tar cvf tofuproxy-"$release".tar --uid=0 --gid=0 --numeric-owner tofuproxy-"$release"
+detpax tofuproxy-"$release" >tofuproxy-"$release".tar
 zstd -22 --ultra -v tofuproxy-"$release".tar
 tarball=tofuproxy-"$release".tar.zst
 ssh-keygen -Y sign -f ~/.ssh/sign/tofuproxy@stargrave.org -n file $tarball
index 86abd6470b562588a54816638ae242e615830fa6..87a992acf9f1464dfac36a5b4520ad687a5fca2f 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 71da97f361bfe33526a696be30e00ac0b2177b62..42138767f18d8539bb33a8809e642aef03038a4d 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -195,7 +195,8 @@ func RoundGemini(
                !strings.Contains(req.Header.Get("Accept"), ContentTypeGemini) {
                w.Header().Add("Content-Type", "text/html")
                w.WriteHeader(http.StatusOK)
-               raw, err := io.ReadAll(br)
+               var raw []byte
+               raw, err = io.ReadAll(br)
                if err != nil {
                        log.Printf("%s: can not read response body: %+v\n", req.URL, err)
                        return false, err
@@ -205,7 +206,7 @@ func RoundGemini(
 <html><head><title>%d (%s)</title></head><body>
 `, code, codeName)
                pre := false
-               for _, line := range strings.Split(string(raw), "\n") {
+               for line := range strings.SplitSeq(string(raw), "\n") {
                        if strings.HasPrefix(line, "```") {
                                if pre {
                                        buf.WriteString("</pre>\n")
index 8f44d47ee33b15c445d8488003b1348b78bec5a9..27616522019ac2f52a8ec6c58bfd85b7cb0f92ff 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index a313b7bb297282e77f30d3de24e81ad5f0e46e0b..98a2b2d528734748006ab57b20255182b26a62f3 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 4f8dec3c437f29de611d7039c1e94067a7efb7ea..429620d30ec7a8dfd580a1af8fbfc4a40348f014 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -43,13 +43,7 @@ var imageExts = map[string]struct{}{
 }
 
 func isFeeder(req *http.Request) bool {
-       if strings.Contains(req.Header.Get("User-Agent"), "newsboat/") {
-               return true
-       }
-       if strings.Contains(req.Header.Get("User-Agent"), "stargrave.org-feeder/") {
-               return true
-       }
-       return false
+       return strings.Contains(req.Header.Get("User-Agent"), "stargrave.org-feeder/")
 }
 
 func RoundRedirectHTML(
index 73f44f520b8f684066f9c936ed2e9cc450b43841..35c5d0cd84ee36e4ce8b85b728d9be3553543446 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 8308adc8bda9cd30ab3074ff88027468d3ac3a88..aee5b2a7775d24251af80a0b8b30a45a1a1468eb 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 122f8618c649e2f9f1561815851c89df825891d3..999dec866cecbf75587a157f3a9ac860d93c8645 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 9915d85e703377e90b7fde67aae0a01fee8a3458..6977641607fdce4856071ab4cd76cb50f9da5224 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 19c745d27bd562659af37d106ff10cfb80a8aa29..9dc8dfe0c0b30e141f8d29206031f02718adeb46 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
diff --git a/tls.go b/tls.go
index 889dba7de3b5d141988f0e8801baa80745fa96fd..f3cbd7a3a4061de363d678198b6e230b0ad83b72 100644 (file)
--- a/tls.go
+++ b/tls.go
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 55ae326ef6e1d04f5d90060bce0ddeabac5323d2..c99d591c5a59536ede62bb142dbaa1887ee96789 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index aead1c8e70eee70c0467ccae91e487cbe052b7fc..9f3b965cb781f76e4c90af72f3e2010f91527ad4 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import (
        "fmt"
        "net"
 
-       "go.cypherpunks.ru/ucspi"
+       "go.cypherpunks.su/ucspi/v2"
        "go.stargrave.org/tofuproxy/fifos"
 )
 
index 1a9d95788b7446fb46cf15f4371ba6d0d41e18e5..98780e66f48e6e51bd131cb1378404bb7515d819 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ import (
        "strconv"
        "strings"
 
-       "go.cypherpunks.ru/ucspi"
+       "go.cypherpunks.su/ucspi/v2"
        "go.stargrave.org/tofuproxy/caches"
        "go.stargrave.org/tofuproxy/fifos"
 )
@@ -56,7 +56,6 @@ func (g *ClientCertificateGetter) get(
        }
        var b bytes.Buffer
        fmt.Fprintf(&b, `
-tk_setPalette grey
 wm title . "TLS client authentication: %s"
 
 set lb [listbox .lb]
@@ -105,11 +104,13 @@ foreach sigScheme {%s} {
        tlsCerts = append(tlsCerts, nil)
        for i, ent := range ents {
                p := filepath.Join(CCerts, ent.Name())
-               _, cert, err := ucspi.CertificateFromFile(p)
+               var cert *x509.Certificate
+               _, cert, err = ucspi.CertificateFromFile(p)
                if err != nil {
                        log.Fatalln(err)
                }
-               prv, err := ucspi.PrivateKeyFromFile(p)
+               var prv any
+               prv, err = ucspi.PrivateKeyFromFile(p)
                if err != nil {
                        log.Fatalln(err)
                }
index 6e45c3eec2a25eae3d849a9f3f7301b37a1bedf3..c861a0fee209fb0cf2fa86c3c31e243b7f3e9667 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ import (
        "strings"
        "sync"
 
-       "go.cypherpunks.ru/ucspi"
+       "go.cypherpunks.su/ucspi/v2"
        "go.stargrave.org/tofuproxy/caches"
        "go.stargrave.org/tofuproxy/fifos"
 )
@@ -65,7 +65,6 @@ proc certsDecode {raws} {
 set certsTheir [certsDecode $certsTheir]
 set certsOur [certsDecode $certsOur]
 
-tk_setPalette grey
 wm title . $host
 
 proc paginator {i delta t l certs} {
diff --git a/trip.go b/trip.go
index 06a6f905c7af6c785aee0359fbe3a9cb375d05e8..63c37d2039fa76795914d2fff8d7d97f4f1ce69b 100644 (file)
--- a/trip.go
+++ b/trip.go
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -103,7 +103,8 @@ Retry:
                fifos.LogVarious <- fmt.Sprintf(
                        "%s %s\tHTTP authorization required", req.Method, req.URL.Host,
                )
-               user, pass, err := authDialog(host, resp.Header.Get("WWW-Authenticate"))
+               var user, pass string
+               user, pass, err = authDialog(host, resp.Header.Get("WWW-Authenticate"))
                if err != nil {
                        caches.HTTPAuthCacheM.Unlock()
                        fifos.LogErr <- fmt.Sprintf("%s\t%s", req.URL.Host, err.Error())
@@ -132,20 +133,23 @@ Retry:
                }
        }
 
-       for _, round := range []Round{
-               rounds.RoundDenyFonts,
-               rounds.RoundTranscodeWebP,
-               rounds.RoundTranscodeJXL,
-               rounds.RoundTranscodeAVIF,
-               rounds.RoundRedirectHTML,
-       } {
-               cont, err := round(host, resp, w, req)
-               if err != nil {
-                       http.Error(w, err.Error(), http.StatusBadGateway)
-                       return
-               }
-               if !cont {
-                       return
+       {
+               var cont bool
+               for _, round := range []Round{
+                       rounds.RoundDenyFonts,
+                       rounds.RoundTranscodeWebP,
+                       rounds.RoundTranscodeJXL,
+                       rounds.RoundTranscodeAVIF,
+                       rounds.RoundRedirectHTML,
+               } {
+                       cont, err = round(host, resp, w, req)
+                       if err != nil {
+                               http.Error(w, err.Error(), http.StatusBadGateway)
+                               return
+                       }
+                       if !cont {
+                               return
+                       }
                }
        }
 
index 84b30c35e5c0e4bf91ece7d498eee2f74578698e..cd48d207e8c50e54b65cbeb820b74fe2dc08476d 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -29,12 +29,11 @@ import (
 )
 
 type CompressedReader struct {
-       cmd     *exec.Cmd
-       fd      *os.File
-       stdout  io.ReadCloser
-       offsets []Offset
-
+       stdout    io.ReadCloser
+       cmd       *exec.Cmd
+       fd        *os.File
        offW      *os.File
+       offsets   []Offset
        offReader sync.WaitGroup
 }
 
@@ -79,7 +78,8 @@ func NewCompressedReader(
                cmd.Stdin = io.MultiReader(bytes.NewReader(dict), fd)
        }
        if offsets == nil {
-               offR, offW, err := os.Pipe()
+               var offR, offW *os.File
+               offR, offW, err = os.Pipe()
                if err != nil {
                        fd.Close()
                        return nil, err
index fc20ac451892e463ee7db57e9f22e3fa5f94abef..53db46889b94ebc0d2bead13865b7ed69c382dd9 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -91,9 +91,9 @@ func NewGZIPReader(
        gr := GZIPReader{r: r}
        go func() {
                z.Multistream(false)
-               var offset, offsetPrev int64
+               var offset, offsetPrev, written int64
                for {
-                       written, err := io.Copy(w, z)
+                       written, err = io.Copy(w, z)
                        if err != nil {
                                w.CloseWithError(err)
                                return
index e5ce877bd09b42a3c8e2a68490ef861698df1ba9..dfeca61f7322dc235af2836f19ab03b482851cce 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index c619bc3375f8fd61f9dbea71f66f1baf70a88f2a..a915d481cb76b0b1feb85bf06bb5177d29167a28 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 50037c734edd89764f494cc8f6410e78bc0487a4..1bfbe2187ee722e6828218970a14cf1fc348517d 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -30,9 +30,9 @@ type Reader struct {
        Path    string
        rrr     RawRecordReader
        br      *bufio.Reader
-       offset  int64
        prevRec *Record
        offsets []Offset
+       offset  int64
 }
 
 func NewReader(warcPath string) (*Reader, error) {
@@ -55,7 +55,7 @@ func (r *Reader) next() error {
                return err
        }
        r.offset += int64(r.prevRec.HdrLen) + r.prevRec.Size
-       for i := 0; i < 2; i++ {
+       for range 2 {
                line, err := r.br.ReadString('\n')
                if err != nil {
                        return err
@@ -81,7 +81,8 @@ func (r *Reader) ReadRecord() (*Record, io.Reader, error) {
        hdrLen := len(line)
        hdr := NewHeader()
        for {
-               line, err := r.br.ReadString('\n')
+               var line string
+               line, err = r.br.ReadString('\n')
                if err != nil {
                        return nil, nil, err
                }
index 38181ab92724bc509f05402a87846624a5efe365..138f92cab6800442d974c3a2ec37868e7c6bb492 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,15 +22,13 @@ import (
 )
 
 type Record struct {
-       WARCPath string
-       Offset   int64
-       Size     int64
-
-       Hdr      Header
-       HdrLen   int
-       HdrLines []string
-
+       WARCPath      string
+       Hdr           Header
+       HdrLines      []string
        Continuations []*Record
+       Offset        int64
+       Size          int64
+       HdrLen        int
 }
 
 func (rec *Record) URI() string {
index c178455a70fb6fb32707d51c4d3cdd2f2b88a6b2..944ee29a22ffd805ef0034d93c5efbb265320922 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
index 56cd415d1a51868fc3b05e99bbd53403431107dd..35cce917e43beb58e3c6be73543dfcb6bf5c849e 100644 (file)
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -46,10 +46,10 @@ func Add(warcPath string) error {
                var uris map[string]*Record
                var offsets []Offset
                dec := gob.NewDecoder(fd)
-               if err := dec.Decode(&uris); err != nil {
+               if err = dec.Decode(&uris); err != nil {
                        return err
                }
-               if err := dec.Decode(&offsets); err != nil {
+               if err = dec.Decode(&offsets); err != nil {
                        return err
                }
                WARCsM.Lock()
@@ -59,7 +59,7 @@ func Add(warcPath string) error {
                log.Println("loaded marshalled index:", warcPath+IndexExt)
                return nil
        }
-       if err != nil && !errors.Is(err, fs.ErrNotExist) {
+       if !errors.Is(err, fs.ErrNotExist) {
                return err
        }
        r, err := NewReader(warcPath)
@@ -135,7 +135,7 @@ func SaveIndices() error {
                fd, err := os.OpenFile(
                        p+tmpSuffix,
                        os.O_WRONLY|os.O_CREATE|os.O_EXCL,
-                       os.FileMode(0666),
+                       os.FileMode(0o666),
                )
                if err != nil {
                        return err
diff --git a/x509.go b/x509.go
index 780c26cdb345381ff4ba7d68b98ccfb56e747285..864c1f356ea047a0652ceb087d206aeb0aa699b7 100644 (file)
--- a/x509.go
+++ b/x509.go
@@ -1,6 +1,6 @@
 // tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU
 //              manager, WARC/geminispace browser
-// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2021-2025 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by