2024-10-16 18:28:20 -06:00
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"bufio"
|
|
|
|
|
"log"
|
|
|
|
|
"os"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
2024-10-16 18:45:19 -06:00
|
|
|
|
const KEY = "5039a811-1b27-4db6-a7f0-c8dd28eeebcd"
|
2024-10-16 18:28:20 -06:00
|
|
|
|
|
|
|
|
|
func replaceCorruptedRune(msg string) string {
|
|
|
|
|
runes := []rune(msg)
|
|
|
|
|
for i, r := range runes {
|
|
|
|
|
if r == '<27>' {
|
|
|
|
|
runes[i] = '§'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return string(runes)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func tailFile(path string, lineCh chan<- string) {
|
|
|
|
|
file, err := os.Open(path)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatalf("Failed to open file: %v", err)
|
|
|
|
|
}
|
|
|
|
|
defer file.Close()
|
|
|
|
|
|
|
|
|
|
file.Seek(0, 2)
|
|
|
|
|
|
|
|
|
|
reader := bufio.NewReader(file)
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
line, err := reader.ReadString('\n')
|
|
|
|
|
if err != nil {
|
|
|
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
lineCh <- line
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-16 18:45:19 -06:00
|
|
|
|
func main() {
|
|
|
|
|
app := NewApp(KEY)
|
|
|
|
|
app.Start()
|
2024-10-16 18:28:20 -06:00
|
|
|
|
}
|