mirror of
https://github.com/go-i2p/go-gitlooseleaf.git
synced 2025-06-30 08:22:14 -04:00
create a meta-listerner softfork
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
downloads
|
17
DOCKER.md
Normal file
17
DOCKER.md
Normal file
@ -0,0 +1,17 @@
|
||||
Docker Instructions:
|
||||
====================
|
||||
|
||||
The Dockerfile in this repo assumes a completely self-contained setup, where I2P resides in the same container as gitea.
|
||||
This is purely for simplicity's sake.
|
||||
In order to build it, use:
|
||||
|
||||
```sh
|
||||
docker build -t go-i2p/go-gittisane .
|
||||
```
|
||||
|
||||
then in order to run it, use:
|
||||
|
||||
```sh
|
||||
docker run --name i2p-gittisane -d go-i2p/go-gittisane
|
||||
docker log i2p-gittinsane
|
||||
```
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@ -0,0 +1,34 @@
|
||||
# Stage 1: Download gittisane
|
||||
FROM alpine:latest as downloader
|
||||
RUN apk add --no-cache curl bash grep
|
||||
WORKDIR /download/
|
||||
COPY download.sh .
|
||||
RUN /download/download.sh
|
||||
RUN ls /download/downloads
|
||||
RUN cp /download/downloads/gitea-Linux /download/gittisane-linux-amd64
|
||||
|
||||
# Stage 2: Runtime
|
||||
FROM geti2p/i2p:latest
|
||||
|
||||
# Copy gittisane binary
|
||||
COPY --from=downloader /download/gittisane-linux-amd64 /usr/local/bin/gittisane
|
||||
RUN chmod +x /usr/local/bin/gittisane
|
||||
|
||||
# Create data directories
|
||||
RUN mkdir -p /data/gitea
|
||||
|
||||
# Configure I2P for SAM
|
||||
RUN echo "i2cp.tcp.host=127.0.0.1\n\
|
||||
i2cp.tcp.port=7654\n\
|
||||
sam.enabled=true\n\
|
||||
sam.host=127.0.0.1\n\
|
||||
sam.port=7656" >> /i2p/router.config
|
||||
|
||||
# Setup volumes
|
||||
VOLUME ["/data/gitea", "/i2p/.i2p"]
|
||||
WORKDIR /data/gitea
|
||||
|
||||
# Create startup script
|
||||
COPY start.sh /usr/local/bin/start.sh
|
||||
|
||||
ENTRYPOINT ["start.sh"]
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 I2P For Go
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
20
LICENSE-gitea.md
Normal file
20
LICENSE-gitea.md
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2016 The Gitea Authors
|
||||
Copyright (c) 2015 The Gogs Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
70
README.bbcode
Normal file
70
README.bbcode
Normal file
@ -0,0 +1,70 @@
|
||||
[size=150][b]go-gittisane[/b][/size]
|
||||
|
||||
[size=100]A soft-fork of gitea with support for running as an I2P service. Just the mod and the CI files.[/size]
|
||||
|
||||
[size=150][b]How it works:[/b][/size]
|
||||
|
||||
[size=100]This uses GitHub CI to continuously build an I2P-only version of Gitea based on the latest release of Gitea. We can do this without requiring a patch to the Gitea source code. This is because Gitea encapsulates its "Listening" and "Dialing" into functions, which can easily be substituted for alternative versions. For instance, the network listener is set up by a function, `graceful.GetListener() (net.Listener, error)` in the file `modules/graceful/server.go`. The default implementation of the `GetListener() (net.Listener, error)` function, `DefaultGetListener() (net.Listener, error)` is defined in the `modules/graceful/net_unix.go` for Unix-like systems and `modules/graceful/net_windows.go` for Windows-like systems. A developer who wishes to "Mod" gitea to listen on another kind of connection do so by creating a new file which implements a `GetListener() (net.Listener, error)` function using an alternate listener implementation.[/size]
|
||||
|
||||
[size=100]On the client side, the same thing is possible because Go allows you to substitute the underlying transports used for the default HTTP Client. So, in the absence of overriding settings, we can configure it to use SAMv3 to build HTTP connections by default using the same keys as the hidden service. Effectively this is like a "Bidirectional HTTP" tunnel in Java's Hidden Service Manager.[/size]
|
||||
|
||||
[size=100]Finally, if you need to include additional libraries, run `go mod tidy` in the root of the gitea checkout to include them.[/size]
|
||||
|
||||
[size=100]Here is a complete working example mod:[/size]
|
||||
|
||||
[code]// copy this file to modules/graceful/net_anon.go before building gitea
|
||||
package graceful
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-i2p/onramp"
|
||||
)
|
||||
|
||||
// First, make sure that the onramp.Garlic API is set up:
|
||||
var garlic, i2perr = onramp.NewGarlic("gitea-anon", "127.0.0.1:7656", onramp.OPT_DEFAULTS)
|
||||
|
||||
// This implements the GetListener function for I2P. Note the exemption for Unix sockets, which is implemented in net_anon_unix.go and net_anon_windows.go
|
||||
func I2PGetListener(network, address string) (net.Listener, error) {
|
||||
// Add a deferral to say that we've tried to grab a listener
|
||||
defer GetManager().InformCleanup()
|
||||
switch network {
|
||||
case "tcp", "tcp4", "tcp6", "i2p", "i2pt":
|
||||
return garlic.Listen()
|
||||
case "unix", "unixpacket":
|
||||
// I2P isn't really a replacement for the stuff you use Unix sockets for and it's also not an anonymity risk, so treat them normally
|
||||
unixAddr, err := net.ResolveUnixAddr(network, address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return GetListenerUnix(network, unixAddr)
|
||||
default:
|
||||
return nil, net.UnknownNetworkError(network)
|
||||
}
|
||||
}
|
||||
|
||||
// We use `init() to ensure that the I2P Listeners and Dialers are correctly placed at runtime`
|
||||
func init() {
|
||||
if i2perr != nil {
|
||||
panic(i2perr)
|
||||
}
|
||||
GetListener = I2PGetListener
|
||||
httpClient := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Dial: garlic.Dial,
|
||||
},
|
||||
}
|
||||
|
||||
http.DefaultClient = httpClient
|
||||
http.DefaultTransport = httpClient.Transport
|
||||
}
|
||||
[/code]
|
||||
[size=125][b]Caveats[/b][/size]
|
||||
|
||||
[size=100]Gitea makes a few other kinds of connections, besides `HTTP`, if instructed to do so in the config file. For instance, there is an SMTP client. This is not anonymized in this configuration. Probably ask Postman if it's OK to use `127.0.0.1:7659/7660`. Similarly, SSH client connections are not anonymized in this configuration. Similar adjustments to the configuration can be made to also route these across I2P but aren't documented here at this time.[/size]
|
||||
|
||||
[size=125][b]License[/b][/size]
|
||||
|
||||
[size=100]Both this mod and gitea are licensed under the MIT license. See LICENSE for net_anon*.go in this repository. LICENSE-gitea.md is a copy of the Gitea license from [url=https://github.com/go-gitea/gitea][color=#388d40]https://github.com/go-gitea/gitea[/color][/url][/size]
|
||||
|
32
download.sh
Executable file
32
download.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set GitHub repo info
|
||||
OWNER="go-i2p"
|
||||
REPO="go-gittisane"
|
||||
|
||||
echo "Fetching latest release info from GitHub..."
|
||||
|
||||
# Get latest release data
|
||||
RELEASE_DATA=$(curl -s "https://api.github.com/repos/$OWNER/$REPO/releases/latest")
|
||||
|
||||
# Extract version number
|
||||
VERSION=$(echo "$RELEASE_DATA" | grep -Po '"tag_name": "\K.*?(?=")')
|
||||
echo "Latest version: $VERSION"
|
||||
|
||||
# Create downloads directory
|
||||
mkdir -p downloads
|
||||
cd downloads
|
||||
|
||||
# Download each asset
|
||||
echo "$RELEASE_DATA" | grep -Po '"browser_download_url": "\K.*?(?=")' | while read -r url; do
|
||||
filename=$(basename "$url")
|
||||
echo "Downloading $filename..."
|
||||
curl -L -o "$filename" "$url"
|
||||
|
||||
# Make Linux/macOS binaries executable
|
||||
if [[ "$filename" != *".exe" ]]; then
|
||||
chmod +x "$filename"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Download complete! Files are in the 'downloads' directory"
|
24
go.mod
Normal file
24
go.mod
Normal file
@ -0,0 +1,24 @@
|
||||
module github.com/go-i2p/go-gittisane
|
||||
|
||||
go 1.23.5
|
||||
|
||||
require (
|
||||
github.com/go-i2p/go-meta-listener v0.0.0-20250410230532-cbd126ff4d54
|
||||
github.com/go-i2p/onramp v0.33.92 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/cretz/bine v0.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-i2p/i2pkeys v0.33.10-0.20241113193422-e10de5e60708 // indirect
|
||||
github.com/go-i2p/sam3 v0.33.9 // indirect
|
||||
github.com/opd-ai/wileedot v0.0.0-20241217172720-521d4175e624 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/stretchr/testify v1.10.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
)
|
51
go.sum
Normal file
51
go.sum
Normal file
@ -0,0 +1,51 @@
|
||||
github.com/cretz/bine v0.2.0 h1:8GiDRGlTgz+o8H9DSnsl+5MeBK4HsExxgl6WgzOCuZo=
|
||||
github.com/cretz/bine v0.2.0/go.mod h1:WU4o9QR9wWp8AVKtTM1XD5vUHkEqnf2vVSo6dBqbetI=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-i2p/go-meta-listener v0.0.0-20250410230532-cbd126ff4d54 h1:uaVE8rzaPS7YbGUAmAXGBdDUgdr/dA4ivT/n/bZRRVs=
|
||||
github.com/go-i2p/go-meta-listener v0.0.0-20250410230532-cbd126ff4d54/go.mod h1:wF/MCCfB40gZyT9WtuYWQkUOPrnoTzA+NG0zpsy3s4M=
|
||||
github.com/go-i2p/i2pkeys v0.0.0-20241108200332-e4f5ccdff8c4/go.mod h1:m5TlHjPZrU5KbTd7Lr+I2rljyC6aJ88HdkeMQXV0U0E=
|
||||
github.com/go-i2p/i2pkeys v0.33.10-0.20241113193422-e10de5e60708 h1:Tiy9IBwi21maNpK74yCdHursJJMkyH7w87tX1nXGWzg=
|
||||
github.com/go-i2p/i2pkeys v0.33.10-0.20241113193422-e10de5e60708/go.mod h1:m5TlHjPZrU5KbTd7Lr+I2rljyC6aJ88HdkeMQXV0U0E=
|
||||
github.com/go-i2p/onramp v0.33.92 h1:Dk3A0SGpdEw829rSjW2LqN8o16pUvuhiN0vn36z7Gpc=
|
||||
github.com/go-i2p/onramp v0.33.92/go.mod h1:5sfB8H2xk05gAS2K7XAUZ7ekOfwGJu3tWF0fqdXzJG4=
|
||||
github.com/go-i2p/sam3 v0.33.9 h1:3a+gunx75DFc6jxloUZTAVJbdP6736VU1dy2i7I9fKA=
|
||||
github.com/go-i2p/sam3 v0.33.9/go.mod h1:oDuV145l5XWKKafeE4igJHTDpPwA0Yloz9nyKKh92eo=
|
||||
github.com/opd-ai/wileedot v0.0.0-20241217172720-521d4175e624 h1:FXCTQV93+31Yj46zpYbd41es+EYgT7qi4RK6KSVrGQM=
|
||||
github.com/opd-ai/wileedot v0.0.0-20241217172720-521d4175e624/go.mod h1:ftKSvvGC9FnxZeuL3B4MB6q/DOzVSV0kET08YUyDwbM=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
71
log
Normal file
71
log
Normal file
@ -0,0 +1,71 @@
|
||||
#0 building with "default" instance using docker driver
|
||||
|
||||
#1 [internal] load .dockerignore
|
||||
#1 transferring context: 2B done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 863B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/alpine:latest
|
||||
#3 ...
|
||||
|
||||
#4 [internal] load metadata for docker.io/geti2p/i2p:latest
|
||||
#4 DONE 0.4s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/alpine:latest
|
||||
#3 DONE 0.5s
|
||||
|
||||
#5 [stage-1 1/7] FROM docker.io/geti2p/i2p:latest@sha256:987fb1f201779832e5e632948550f40a93c48671c47baa6e6f423d3a774c3010
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [downloader 1/7] FROM docker.io/library/alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [internal] load build context
|
||||
#7 transferring context: 321B done
|
||||
#7 DONE 0.0s
|
||||
|
||||
#8 [downloader 5/7] RUN /download/download.sh
|
||||
#8 CACHED
|
||||
|
||||
#9 [stage-1 2/7] COPY --from=downloader /download/gittisane-linux-amd64 /usr/local/bin/gittisane
|
||||
#9 CACHED
|
||||
|
||||
#10 [stage-1 3/7] RUN chmod +x /usr/local/bin/gittisane
|
||||
#10 CACHED
|
||||
|
||||
#11 [downloader 2/7] RUN apk add --no-cache curl bash grep
|
||||
#11 CACHED
|
||||
|
||||
#12 [downloader 4/7] COPY download.sh .
|
||||
#12 CACHED
|
||||
|
||||
#13 [downloader 6/7] RUN ls /download/downloads
|
||||
#13 CACHED
|
||||
|
||||
#14 [downloader 7/7] RUN cp /download/downloads/gitea-Linux /download/gittisane-linux-amd64
|
||||
#14 CACHED
|
||||
|
||||
#15 [stage-1 5/7] RUN echo "i2cp.tcp.host=127.0.0.1\ni2cp.tcp.port=7654\nsam.enabled=true\nsam.host=127.0.0.1\nsam.port=7656" >> /i2p/router.config
|
||||
#15 CACHED
|
||||
|
||||
#16 [downloader 3/7] WORKDIR /download/
|
||||
#16 CACHED
|
||||
|
||||
#17 [stage-1 4/7] RUN mkdir -p /data/gitea
|
||||
#17 CACHED
|
||||
|
||||
#18 [stage-1 6/7] WORKDIR /data/gitea
|
||||
#18 CACHED
|
||||
|
||||
#19 [stage-1 7/7] COPY start.sh /usr/local/bin/start.sh
|
||||
#19 DONE 0.1s
|
||||
|
||||
#20 exporting to image
|
||||
#20 exporting layers
|
||||
#20 exporting layers 0.1s done
|
||||
#20 writing image sha256:58fcf470db80e45d1ae0a47cb147dbbed45d6b74b22f27cb696de5ffbc53964d done
|
||||
#20 naming to docker.io/go-i2p/go-gittisane 0.0s done
|
||||
#20 DONE 0.1s
|
38
net_anon.go
Normal file
38
net_anon.go
Normal file
@ -0,0 +1,38 @@
|
||||
// copy this file to modules/graceful/net_anon.go before building gitea
|
||||
package graceful
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/go-i2p/go-meta-listener/mirror"
|
||||
)
|
||||
|
||||
// This implements the GetListener function for I2P. Note the exemption for Unix sockets.
|
||||
func MultiGetListener(network, address string) (net.Listener, error) {
|
||||
// Add a deferral to say that we've tried to grab a listener
|
||||
defer GetManager().InformCleanup()
|
||||
switch network {
|
||||
case "unix", "unixpacket":
|
||||
// I2P isn't really a replacement for the stuff you use Unix sockets for and it's also not an anonymity risk, so treat them normally
|
||||
unixAddr, err := ResolveUnixAddr(network, address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return GetListenerUnixWrapper(network, unixAddr)
|
||||
default:
|
||||
return mirror.Listen("tcp", address, "./certs", true)
|
||||
}
|
||||
}
|
||||
|
||||
// We use `init() to ensure that the I2P Listeners and Dialers are correctly placed at runtime`
|
||||
func init() {
|
||||
GetListener = MultiGetListener
|
||||
/*httpClient := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Dial: garlic.Dial,
|
||||
},
|
||||
}
|
||||
|
||||
http.DefaultClient = httpClient
|
||||
http.DefaultTransport = httpClient.Transport*/
|
||||
}
|
32
net_anon_unix.go
Normal file
32
net_anon_unix.go
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||
|
||||
//go:build !windows
|
||||
|
||||
package graceful
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func ResolveUnixAddr(network, address string) (net.Addr, error) {
|
||||
switch network {
|
||||
case "unix", "unixpacket":
|
||||
return net.ResolveUnixAddr(network, address)
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown network type %s", network)
|
||||
}
|
||||
}
|
||||
|
||||
func GetListenerUnixWrapper(network string, addr net.Addr) (net.Listener, error) {
|
||||
switch addr.(type) {
|
||||
case *net.UnixAddr:
|
||||
return GetListenerUnix(network, addr.(*net.UnixAddr))
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown address type %T", addr)
|
||||
}
|
||||
|
||||
}
|
27
net_anon_windows.go
Normal file
27
net_anon_windows.go
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||
|
||||
//go:build windows
|
||||
|
||||
package graceful
|
||||
|
||||
import "net"
|
||||
|
||||
func ResolveUnixAddr(network, address string) (net.Addr, error) {
|
||||
switch network {
|
||||
case "unix", "unixpacket":
|
||||
return net.ResolveUnixAddr(network, address)
|
||||
case "tcp", "tcp4", "tcp6":
|
||||
return net.ResolveTCPAddr(network, address)
|
||||
case "udp", "udp4", "udp6":
|
||||
return net.ResolveUDPAddr(network, address)
|
||||
default:
|
||||
return nil, net.UnknownNetworkError(network)
|
||||
}
|
||||
}
|
||||
|
||||
func GetListenerUnixWrapper(network string, addr net.Addr) (net.Listener, error) {
|
||||
return net.Listen(network, addr.String())
|
||||
}
|
10
start.sh
Executable file
10
start.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#! /bin/sh
|
||||
nohup /startapp.sh 2> err.log 1> log.log &
|
||||
export countdown=30
|
||||
while [ countdown -gt 0 ]; do
|
||||
echo "Waiting for app to start... $countdown seconds left"
|
||||
countdown=$((countdown - 1))
|
||||
sleep 1
|
||||
done
|
||||
ls /usr/local/bin
|
||||
/usr/local/bin/gittisane web
|
Reference in New Issue
Block a user