-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
42 lines (34 loc) · 807 Bytes
/
main.go
File metadata and controls
42 lines (34 loc) · 807 Bytes
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
package main
import (
"fmt"
"fntv-proxy/config"
"fntv-proxy/handler"
"fntv-proxy/logger"
"log"
"net/http"
)
func main() {
// Initialize logger
logger.Init()
// Load config file
conf, err := config.LoadConfig("config.ini")
if err != nil {
log.Fatalf("Failed to load config file: %v", err)
}
// Start HTTP server
port := conf.Port
if port == 0 {
port = 1999 // Default port
}
mux := http.NewServeMux()
// Setup routes
mux.HandleFunc("/proxy/info", handler.HandleProxyInfo)
mux.HandleFunc("/proxyGet", handler.HandleProxyGet)
mux.HandleFunc("/", handler.HandleVLCRequest)
server := &http.Server{
Addr: fmt.Sprintf(":%d", port),
Handler: mux,
}
logger.StdoutLogger.Printf("VLC Proxy service started, listening on port: %d", port)
log.Fatal(server.ListenAndServe())
}