New Upstream Release - golang-github-makeworld-the-better-one-go-gemini
Ready changes
Summary
Merged new upstream version: 0.13.1 (was: 0.13.0).
Resulting package
Built on 2023-03-23T23:21 (took 4m9s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases golang-github-makeworld-the-better-one-go-gemini-dev
Lintian Result
- golang-github-makeworld-the-better-one-go-gemini-dev_0.13.1-1~jan+nur1_all.deb
- golang-github-makeworld-the-better-one-go-gemini_0.13.1-1~jan+nur1.dsc
- golang-github-makeworld-the-better-one-go-gemini_0.13.1-1~jan+nur1_amd64.buildinfo
- golang-github-makeworld-the-better-one-go-gemini_0.13.1-1~jan+nur1_amd64.changes
Diff
diff --git a/client.go b/client.go
index 34ece9e..ce850fe 100644
--- a/client.go
+++ b/client.go
@@ -75,6 +75,9 @@ type header struct {
meta string
}
+// ProxyFunc. See Client documentation
+type ProxyFunc func(dialer *net.Dialer, address string) (net.Conn, error)
+
type Client struct {
// NoTimeCheck allows connections with expired or future certs if set to true.
NoTimeCheck bool
@@ -108,6 +111,26 @@ type Client struct {
// For example, if this is set to 30 seconds, then no more reading from the connection
// can happen 30 seconds after the initial handshake.
ReadTimeout time.Duration
+
+ // Proxy is a function that returns an existing connection. The TLS client
+ // will use this as the underlying transport, instead of making a direct TCP
+ // connection.
+ //
+ // go-gemini requires setting a dialer on the underlying connection, to impose
+ // a timeout on making the initial connection. This dialer is provided as an
+ // argument to the proxy function.
+ //
+ // The other argument provided is the address being connected to. For example
+ // "example.com:1965".
+ //
+ // Any errors returned will prevent a connection from occurring.
+ //
+ // This is not "gemini proxying", aka the proxying functionality built in to
+ // the Gemini protocol. This is for proxying requests over TOR, or SOCKS5, etc.
+ //
+ // func(dialer *net.Dialer, address string) (net.Conn, error)
+ //
+ Proxy ProxyFunc
}
var DefaultClient = &Client{ConnectTimeout: 15 * time.Second}
@@ -145,7 +168,7 @@ func (c *Client) Fetch(rawURL string) (*Response, error) {
}
// FetchWithHost fetches a resource from a Gemini server at the given host, with the given URL.
-// This can be used for proxying, where the URL host and actual server don't match.
+// This can be used for Gemini proxying, where the URL host and actual server don't match.
// It assumes the host is using port 1965 if no port number is provided.
func (c *Client) FetchWithHost(host, rawURL string) (*Response, error) {
// Call with empty PEM bytes to skip using a cert
@@ -303,11 +326,27 @@ func (c *Client) connect(res *Response, host string, parsedURL *url.URL, clientC
}
}
- // Dialer timeout for handshake
- conn, err := tls.DialWithDialer(&net.Dialer{Timeout: c.ConnectTimeout}, "tcp", host, conf)
- res.conn = conn
- if err != nil {
- return conn, err
+ var conn *tls.Conn
+ var err error
+ if c.Proxy == nil {
+ // Dialer timeout for handshake
+ conn, err = tls.DialWithDialer(&net.Dialer{Timeout: c.ConnectTimeout}, "tcp", host, conf)
+ res.conn = conn
+ if err != nil {
+ return conn, err
+ }
+ } else {
+ // Use proxy
+ proxyConn, err := c.Proxy(&net.Dialer{Timeout: c.ConnectTimeout}, host)
+ if err != nil {
+ return nil, err
+ }
+ conn = tls.Client(proxyConn, conf)
+ // Make handshake manually to start connection, so later call to
+ // conn.ConnectionState() works
+ if err := conn.Handshake(); err != nil {
+ return nil, err
+ }
}
if c.ReadTimeout != 0 {
diff --git a/debian/changelog b/debian/changelog
index 4d49901..bdb34c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+golang-github-makeworld-the-better-one-go-gemini (0.13.1-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Thu, 23 Mar 2023 23:17:36 -0000
+
golang-github-makeworld-the-better-one-go-gemini (0.12.1-2) unstable; urgency=medium
[ Debian Janitor ]
diff --git a/go.mod b/go.mod
index a931ef2..a285a1a 100644
--- a/go.mod
+++ b/go.mod
@@ -4,5 +4,5 @@ go 1.14
require (
github.com/google/go-cmp v0.3.1
- golang.org/x/net v0.0.0-20201216054612-986b41b23924
+ golang.org/x/net v0.7.0
)
diff --git a/go.sum b/go.sum
index 61cdf3c..801e988 100644
--- a/go.sum
+++ b/go.sum
@@ -1,9 +1,31 @@
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-golang.org/x/net v0.0.0-20201216054612-986b41b23924 h1:QsnDpLLOKwHBBDa8nDws4DYNc/ryVW2vCpxCs09d4PY=
-golang.org/x/net v0.0.0-20201216054612-986b41b23924/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
+golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files