~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
51 lines · 1.4 KB Raw History
// Command interop-check holds the parts of the interop harness that need a
// real AT Protocol implementation to judge zds: a validating PLC directory,
// a strict firehose consumer, a repo verifier and a summary comparer. It is
// built on indigo's atproto packages, the same code the reference relay and
// goat use, pinned in go.mod. Nothing here depends on zds; any PDS or relay
// can be pointed at it. The relay lane is the separate ./relay binary.
package main

import (
	"fmt"
	"os"
)

const usage = `usage: interop-check <command> [flags]

commands:
  plc       serve a validating in-memory PLC directory
  firehose  consume subscribeRepos strictly and write a state summary
  repo      verify each account's exported repo against a firehose summary
  compare   check that two firehose summaries describe the same repos

run "interop-check <command> -h" for a command's flags.
`

func main() {
	if len(os.Args) < 2 {
		fmt.Fprint(os.Stderr, usage)
		os.Exit(2)
	}
	var err error
	switch os.Args[1] {
	case "plc":
		err = runPLC(os.Args[2:])
	case "firehose":
		err = runFirehose(os.Args[2:])
	case "repo":
		err = runRepo(os.Args[2:])
	case "compare":
		err = runCompare(os.Args[2:])
	case "-h", "--help", "help":
		fmt.Print(usage)
		return
	default:
		fmt.Fprint(os.Stderr, usage)
		os.Exit(2)
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "interop-check:", err)
		os.Exit(1)
	}
}