~nvkv/amitm

ref: 2ababae5415c18db39238bbdf965f1d60b1f7def amitm/cmd/amitm/main.go -rw-r--r-- 462 bytes
2ababae5Semyon Novikov Add missing cmd dir 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)
		}
	}
}