~nvkv/amitm

2ababae5415c18db39238bbdf965f1d60b1f7def — Semyon Novikov a month ago 9e78476
Add missing cmd dir
1 files changed, 33 insertions(+), 0 deletions(-)

A cmd/amitm/main.go
A cmd/amitm/main.go => cmd/amitm/main.go +33 -0
@@ 0,0 1,33 @@
package main

import (
	"fmt"
	"log"

	"9fans.net/go/acme"
	"git.sr.ht/~nvkv/amitm/internal/config/v1"
)

func main() {
	l, err := acme.Log()
	if err != nil {
		log.Fatal(err)
	}

	config, err := config.ReadConfigFile("./examples/amitm.toml")
	if err != nil {
		log.Fatal(err)
	}

	for {
		event, err := l.Read()
		if err != nil {
			log.Fatal(err)
		}

		rules, ok := config.RulesForAction(event.Op)
		if ok {
			fmt.Printf("%+v -> %+v", event, rules)
		}
	}
}