-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
57 lines (46 loc) · 1.28 KB
/
main.go
File metadata and controls
57 lines (46 loc) · 1.28 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* This file is part of the Rubrion Group.
*
* Licensed under the Rubrion Public License (RPL), Version 1, 2026.
* You may not use this file except in compliance with the License.
*
* License:
* https://rubrionmc.github.io/.github/licensens/RUBRION_PUBLIC_LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* Copyright (c) 2024 Rubrion Group. All rights reserved.
*/
package main
import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
)
func main() {
var configPath string
flag.StringVar(&configPath, "c", "", "Path to config file")
flag.StringVar(&configPath, "config", "", "Path to config file")
flag.Parse()
if configPath == "" {
configPath = "config.toml"
}
config, err := LoadConfigFromFile(configPath)
if err != nil {
log.Fatalf("Failed to load config: %v", err)
}
fmt.Println("Using config:", configPath)
proxy := NewProxy(config)
proxy.Start()
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
log.Println("Proxy is running. Press Ctrl+C to stop.")
<-sigChan
log.Println("Received shutdown signal, stopping proxy...")
proxy.Stop()
}