mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
Message areas given an echo tag are FTN echoes; mail addressed to Name@zone:net/node is netmail, and netmail for this system arrives as private mail that Reply answers. The BBS is its own tosser and scanner (Type 2+ packets, ZIP bundles, MSGID/REPLY threading, SEEN-BY and PATH, character sets by CHRS, dupe and loop checks, forwarding between links) and mailer: binkp answering and calling, with CRAM-MD5. An area that is both an echo and a newsgroup gates between them. bbs area echo and bbs fido poll|scan|toss administer it. Tested between BBSes and against binkd and CrashMail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package server
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestFidoConfig(t *testing.T) {
|
|
load := func(body string) (*Config, error) {
|
|
p := filepath.Join(t.TempDir(), "bbs.conf")
|
|
os.WriteFile(p, []byte("[listen telnet]\ntype = telnet\naddress = :2300\n"+body), 0600)
|
|
return Load(p)
|
|
}
|
|
c, err := load(`
|
|
[fido]
|
|
address = 21:1/200 2:5020/9999.1
|
|
[binkp]
|
|
[link hub]
|
|
address = 21:1/100
|
|
host = hub.example
|
|
password = secret
|
|
packet_password = PKT
|
|
echoes = FSX_*,!FSX_BOT
|
|
route = yes
|
|
poll = 3600
|
|
[link other]
|
|
address = 2:5020/1
|
|
packer = none
|
|
`)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
f := c.Fido
|
|
if len(f.Addrs) != 2 || f.Addrs[1].Point != 1 || f.Dir != "fido" || c.Binkp.Address != ":24554" {
|
|
t.Fatalf("%+v %+v", f, c.Binkp)
|
|
}
|
|
hub := f.Links[0]
|
|
if hub.Host != "hub.example:24554" || !hub.Zip || !hub.Route || hub.Poll != time.Hour || hub.PktPassword != "PKT" {
|
|
t.Fatalf("%+v", hub)
|
|
}
|
|
if f.Links[1].Zip || !strings.Contains(strings.Join(c.Warnings, "\n"), "[link other] has no password") {
|
|
t.Fatalf("%+v %v", f.Links[1], c.Warnings)
|
|
}
|
|
for body, want := range map[string]string{
|
|
"[fido]\n": "[fido] address",
|
|
"[fido]\naddress = 21:1\n": "not an FTN address",
|
|
"[link x]\naddress = 1:1/1\n": "need a [fido] section",
|
|
"[fido]\naddress = 1:1/1\n[link x]\n": "address",
|
|
"[fido]\naddress = 1:1/1\n[link x]\naddress = 1:1/1\n": "our own address",
|
|
"[fido]\naddress = 1:1/1\n[link a]\naddress = 1:1/2\nroute = yes\n[link b]\naddress = 1:1/3\nroute = yes\n": "more than one",
|
|
"[fido]\naddress = 1:1/1\n[link a]\naddress = 1:1/2\n[link b]\naddress = 1:1/2\n": "has the address of",
|
|
"[fido]\naddress = 1:1/1\n[link a]\naddress = 1:1/2\npacket_password = 123456789\n": "8 characters",
|
|
"[fido]\naddress = 1:1/1\ncharset = koi8\n": "charset",
|
|
} {
|
|
if _, err := load(body); err == nil || !strings.Contains(err.Error(), want) {
|
|
t.Errorf("%q: %v, want %q", body, err, want)
|
|
}
|
|
}
|
|
}
|