9 Commits

Author SHA1 Message Date
idk
42fdc2a7d1 why is it pointing at my fing wiki? 2019-12-07 20:38:19 -05:00
idk
8c3865cb63 why is it pointing at my fing wiki? 2019-12-07 20:32:35 -05:00
idk
78aa7d0542 update the port it uses 2019-12-07 20:10:54 -05:00
idk
68c0d918a6 update the port it uses 2019-12-07 19:28:14 -05:00
idk
0f2cf31aa7 add .readme.md 2019-12-07 19:17:28 -05:00
idk
4d57e576ff add .readme.md 2019-12-07 19:14:30 -05:00
idk
22e1b234db update test command 2019-12-07 19:07:34 -05:00
idk
84077c1116 also serve it 2019-12-07 15:59:00 -05:00
idk
56d988962a get readme ready 2019-12-07 15:33:40 -05:00
5 changed files with 75 additions and 23 deletions

25
.readme.md Normal file
View File

@ -0,0 +1,25 @@
RepoSAM
=======
A self-configuring Debian repository for I2P based on
[repogen](https://github.com/geek1011/repogen) and sam-forwarder. Works as an
alternative launcher for a repogen apt server that automatically forwards it to
I2P.
Compile/Installation
--------------------
[repogen](https://github.com/geek1011/repogen) is an apt repository management
tool with a web interface.
With your GOPATH set:
git clone https://github.com/eydeekay/reposam $GOPATH/src/github.com/eyedeekay/reposam
cd $GOPATH/src/github.com/eyedeekay/reposam
make
sudo make install
Usage
-----
See README.md

View File

@ -1,5 +1,10 @@
-include ../config.mk
GO111MODULE=on
VERSION=0.0.1
packagename=reposam
USER_GH=eyedeekay
build: fmt readme
go build -tags netgo \
@ -7,14 +12,16 @@ build: fmt readme
-o reposam/reposam ./reposam
try: build
cd tmp && ../reposam/reposam
cd tmp && ../reposam/reposam -wa -il 1 -ol 1 -key $(PRIVATE_KEY) -id $(DEB_PKG) -od $(DEB_REPO)
readme:
cat .readme.md > README.md
sed 's|See README.md||g' .readme.md > README.md
@echo '' | tee -a README.md
@echo '' | tee -a README.md
@echo '' | tee -a README.md
./reposam/reposam -h 2>&1 | sed 's| | |g' | sed 's| | |g' | sed 's|Usage| Usage|g' |tee -a README.md
./reposam/reposam -h 2>&1 | \
sed 's| | |g' | \
sed 's| | |g' | \
sed 's|Usage| Usage|g' | \
tee -a README.md
install:
install -m755 reposam/reposam /usr/local/bin
@ -26,4 +33,10 @@ fixup:
sed -i 's|CowYoSam|RepoSam|g' *.go
sed -i 's|cowyosam|reposam|g' *.go
sed -i 's|CowYoSam|RepoSam|g' reposam/*.go
sed -i 's|cowyosam|reposam|g' reposam/*.go
sed -i 's|cowyosam|reposam|g' reposam/*.go
tag: build
cat .readme.md | gothub release -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(packagename) -t v$(VERSION) -d -
#del:
# gothub delete -s $(GITHUB_TOKEN) -u $(USER_GH) -r $(packagename) -t v$(VERSION)

View File

@ -7,7 +7,7 @@ alternative launcher for a repogen apt server that automatically forwards it to
I2P.
Compile/Installation
====================
--------------------
[repogen](https://github.com/geek1011/repogen) is an apt repository management
tool with a web interface.
@ -19,6 +19,9 @@ With your GOPATH set:
make
sudo make install
Usage
-----
Usage of ./reposam/reposam:
-a string
@ -35,13 +38,13 @@ With your GOPATH set:
generate a web interface for browsing the packages
-i save i2p keys(and thus destinations) across reboots (default true)
-ib int
Set inbound tunnel backup quantity(0 to 5) (default 1)
Set inbound tunnel backup quantity(0 to 5) (default 2)
-id string
directory to look for packages (default "not_a_dir")
-il int
Set inbound tunnel length(0 to 7) (default 3)
Set inbound tunnel length(0 to 7) (default 2)
-iq int
Set inbound tunnel quantity(0 to 15) (default 2)
Set inbound tunnel quantity(0 to 15) (default 4)
-iv int
Set inbound tunnel length variance(-7 to 7)
-key string
@ -55,19 +58,19 @@ With your GOPATH set:
-n string
name to give the tunnel(default reposam) (default "reposam")
-ob int
Set outbound tunnel backup quantity(0 to 5) (default 1)
Set outbound tunnel backup quantity(0 to 5) (default 2)
-od string
directory to output the repository (default "not_a_dir")
-ol int
Set outbound tunnel length(0 to 7) (default 3)
Set outbound tunnel length(0 to 7) (default 2)
-oq int
Set outbound tunnel quantity(0 to 15) (default 2)
Set outbound tunnel quantity(0 to 15) (default 4)
-or string
sets the origin field used in the Release file (default "reposam")
-ov int
Set outbound tunnel length variance(-7 to 7)
-p string
port to serve locally on (default "7880")
port to serve locally on (default "7888")
-r Reduce tunnel quantity when idle(true or false)
-rc int
Reduce idle tunnel quantity to X (0 to 5) (default 3)

View File

@ -4,6 +4,7 @@ import (
"crypto/rand"
"golang.org/x/crypto/bcrypt"
"log"
"net/http"
"github.com/eyedeekay/sam-forwarder/interface"
"github.com/eyedeekay/sam-forwarder/tcp"
@ -58,11 +59,21 @@ func (f *RepoSam) ServeParent() {
}
}
func (f *RepoSam) ServeRepo() {
if err := f.Repo.ServeRepo(f.watch, true, f.privateKey, f.inRoot, f.outRoot, f.watchInterval); err != nil {
f.Cleanup()
}
}
//Serve starts the SAM connection and and forwards the local host:port to i2p
func (f *RepoSam) Serve() error {
go f.ServeParent()
if f.Up() {
if err = f.Repo.ServeRepo(f.watch, true, f.privateKey, f.inRoot, f.outRoot, f.watchInterval); err != nil {
go f.ServeRepo()
fs := http.FileServer(http.Dir(f.outRoot))
http.Handle("/", fs)
log.Println("Forwarding repo hosted at", f.Target())
if err := http.ListenAndServe(f.Target(), nil); err != nil {
return err
}
}

View File

@ -29,7 +29,7 @@ var cfg = &tls.Config{
var (
host = flag.String("a", "127.0.0.1", "hostname to serve on")
port = flag.String("p", "7880", "port to serve locally on")
port = flag.String("p", "7888", "port to serve locally on")
samhost = flag.String("sh", "127.0.0.1", "sam host to connect to")
samport = flag.String("sp", "7656", "sam port to connect to")
//directory = flag.String("d", "./www", "the directory of static files to host(default ./www)")
@ -42,14 +42,14 @@ var (
reduceIdle = flag.Bool("r", false, "Reduce tunnel quantity when idle(true or false)")
reduceIdleTime = flag.Int("rt", 600000, "Reduce tunnel quantity after X (milliseconds)")
reduceIdleQuantity = flag.Int("rc", 3, "Reduce idle tunnel quantity to X (0 to 5)")
inLength = flag.Int("il", 3, "Set inbound tunnel length(0 to 7)")
outLength = flag.Int("ol", 3, "Set outbound tunnel length(0 to 7)")
inQuantity = flag.Int("iq", 2, "Set inbound tunnel quantity(0 to 15)")
outQuantity = flag.Int("oq", 2, "Set outbound tunnel quantity(0 to 15)")
inLength = flag.Int("il", 2, "Set inbound tunnel length(0 to 7)")
outLength = flag.Int("ol", 2, "Set outbound tunnel length(0 to 7)")
inQuantity = flag.Int("iq", 4, "Set inbound tunnel quantity(0 to 15)")
outQuantity = flag.Int("oq", 4, "Set outbound tunnel quantity(0 to 15)")
inVariance = flag.Int("iv", 0, "Set inbound tunnel length variance(-7 to 7)")
outVariance = flag.Int("ov", 0, "Set outbound tunnel length variance(-7 to 7)")
inBackupQuantity = flag.Int("ib", 1, "Set inbound tunnel backup quantity(0 to 5)")
outBackupQuantity = flag.Int("ob", 1, "Set outbound tunnel backup quantity(0 to 5)")
inBackupQuantity = flag.Int("ib", 2, "Set inbound tunnel backup quantity(0 to 5)")
outBackupQuantity = flag.Int("ob", 2, "Set outbound tunnel backup quantity(0 to 5)")
iniFile = flag.String("f", "none", "Use an ini file for configuration")
useTLS = flag.Bool("t", false, "Generate or use an existing TLS certificate")
certFile = flag.String("m", "cert", "Certificate name to use")
@ -163,7 +163,7 @@ func main() {
reposam.SetAccessListType(config.AccessListType),
reposam.SetAccessList(config.AccessList),
//
reposam.SetWatchDir(*outRoot),
reposam.SetWatchDir(*inRoot),
reposam.SetServeDir(*outRoot),
reposam.SetGenContents(*generateContents),
reposam.SetMaintainerOverride(*maintainerOverride),