3 Commits

Author SHA1 Message Date
idk
66473209bd upgrade 2021-12-11 19:28:35 -05:00
idk
7bffda6818 give it a page too 2021-12-11 15:38:45 -05:00
idk
73fe81d8d1 give it a page too 2021-12-11 15:18:06 -05:00
4 changed files with 32 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
VERSION=0.0.02
VERSION=0.0.03
CGO_ENABLED=0
export CGO_ENABLED=0
@@ -10,6 +10,7 @@ ARG=-v -tags netgo -ldflags '-w -extldflags "-static"'
BINARY=terrarium
SIGNER=hankhill19580@gmail.com
CONSOLEPOSTNAME=IRC
USER_GH=eyedeekay
build: dep
go build $(ARG) -tags="netgo" -o $(BINARY)-$(GOOS)-$(GOARCH) ./cmd/$(BINARY)
@@ -64,10 +65,10 @@ sum:
sha256sum $(BINARY)-$(GOOS)-$(GOARCH).su3
version:
@echo gothub release -u eyedeekay -r terrarium -t "$(VERSION)" -d "`cat desc`"; true
gothub release -u eyedeekay -r terrarium -t "$(VERSION)" -d "`cat desc`"; true
upload:
@echo gothub upload -u eyedeekay -r terrarium -t "$(VERSION)" -f $(BINARY)-$(GOOS)-$(GOARCH).su3 -n $(BINARY)-$(GOOS)-$(GOARCH).su3 -l "`sha256sum $(BINARY)-$(GOOS)-$(GOARCH).su3`"
gothub upload -u eyedeekay -r terrarium -t "$(VERSION)" -f $(BINARY)-$(GOOS)-$(GOARCH).su3 -n $(BINARY)-$(GOOS)-$(GOARCH).su3 -l "`sha256sum $(BINARY)-$(GOOS)-$(GOARCH).su3`"
upload-windows:
GOOS=windows GOARCH=amd64 make upload
@@ -90,10 +91,17 @@ upload-all: upload-windows upload-linux upload-osx upload-bsd
download-su3s:
GOOS=windows GOARCH=amd64 make download-single-su3
GOOS=windows GOARCH=386 make download-single-su3
GOOS=linux GOARCH=amd64 make download-single-su3
GOOS=linux GOARCH=arm64 make download-single-su3
GOOS=linux GOARCH=386 make download-single-su3
GOOS=darwin GOARCH=amd64 make download-single-su3
GOOS=darwin GOARCH=arm64 make download-single-su3
GOOS=freebsd GOARCH=amd64 make download-single-su3
GOOS=openbsd GOARCH=amd64 make download-single-su3
download-single-su3:
wget -N -c "https://github.com/$(USER_GH)/$(REPO_NAME)/releases/download/$(VERSION)/$(BINARY)-$(GOOS).su3"
wget -N -c "https://github.com/$(USER_GH)/$(BINARY)/releases/download/$(VERSION)/$(BINARY)-$(GOOS)-$(GOARCH).su3"
release: clean all version upload-all

View File

@@ -1,4 +1,4 @@
![terrarium](doc/terrarium-with-text.png)
# ![terrarium](doc/terrarium-with-text.png)
[![Build
Status](https://travis-ci.org/eyedeekay/terrarium.svg)](https://travis-ci.org/eyedeekay/terrarium)

View File

@@ -5,9 +5,7 @@
<link rel="stylesheet" type="text/css" href ="/style.css" />
</head>
<body>
<figure>
<img src="doc/terrarium-with-text.png" alt="" /><figcaption>terrarium</figcaption>
</figure>
<h1 id="terrarium"><img src="doc/terrarium-with-text.png" alt="terrarium" /></h1>
<p><a href="https://travis-ci.org/eyedeekay/terrarium"><img src="https://travis-ci.org/eyedeekay/terrarium.svg" alt="Build Status" /></a> <a href="https://goreportcard.com/report/i2pgit.org/idk/terrarium"><img src="https://goreportcard.com/badge/i2pgit.org/idk/terrarium" alt="Go Report Card" /></a></p>
<p>terrarium is an IRC server with a focus on being small and understandable, originally forked from <a href="https://github.com/horgh/catbox">horgh/catbox</a>. The goal is to create an easy-to-configure I2P IRC server which is highly stable and secure, while retaining the ability to link with non-I2P IRC servers using TLS in order to bridge anonymous and non-anonymous chat. For now, Bridged servers are not anonymous, this may change in the future as I evaluate the feasibility of outproxies or Tor.</p>
<h1 id="features">Features</h1>

21
main.go
View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net"
"os"
"os/signal"
@@ -204,7 +205,18 @@ const ExcessFloodThreshold = 50
// from a user.
const ChanModesPerCommand = 4
func randString() string {
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
n := 3
b := make([]rune, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}
func NewCatbox(configFile string) (*Catbox, error) {
rand.Seed(time.Now().UnixNano())
cb := Catbox{
ConfigFile: configFile,
LocalClients: make(map[uint64]*LocalClient),
@@ -228,6 +240,9 @@ func NewCatbox(configFile string) (*Catbox, error) {
if err != nil {
return nil, fmt.Errorf("configuration problem: %s", err)
}
if cfg.ServerName == "irc.terrarium.i2p" {
cfg.ServerName = randString() + ".dirt.i2p"
}
cb.Config = cfg
if cb.Config.ListenPortTLS != "-1" || cb.Config.CertificateFile != "" ||
@@ -357,18 +372,18 @@ func (cb *Catbox) Start(listenFD int) error {
// I2P Listener with TLS
if cb.Config.ListenI2PTLS != "-1" {
ln, err := sam.I2PListener(cb.Config.ListenI2P, cb.Config.SAMAddress, cb.Config.ListenI2P)
ln, err := sam.I2PListener(cb.Config.ListenI2PTLS, cb.Config.SAMAddress, cb.Config.ListenI2PTLS)
if err != nil {
return fmt.Errorf("unable to listen (I2P): %s", err)
}
tlsln := tls.NewListener(ln, cb.TLSConfig)
cb.I2PListenerTLS = tlsln
err = ioutil.WriteFile(cb.Config.ListenI2P+".i2paddresshelper", []byte("http://"+cb.Config.ListenI2P+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
err = ioutil.WriteFile(cb.Config.ListenI2PTLS+".tls.i2paddresshelper", []byte("http://"+cb.Config.ListenI2PTLS+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
if err != nil {
return fmt.Errorf("unable to write I2P addresshelper link to file: %s", err)
}
if strings.HasSuffix(cb.Config.ServerName, ".i2p") {
err = ioutil.WriteFile(cb.Config.ServerName+".i2paddresshelper", []byte("http://"+cb.Config.ServerName+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
err = ioutil.WriteFile(cb.Config.ServerName+".tls.i2paddresshelper", []byte("http://"+cb.Config.ServerName+"?i2paddresshelper="+cb.I2PListener.Addr().String()), 0644)
if err != nil {
return fmt.Errorf("unable to write I2P addresshelper link to file: %s", err)
}