Moge-Row commited on
Commit
22c8f3c
·
1 Parent(s): 56226b8

restore correct main.go

Browse files
Files changed (1) hide show
  1. main.go +23 -11
main.go CHANGED
@@ -1,18 +1,30 @@
1
  package main
2
 
3
  import (
 
 
 
 
 
4
  "net/http"
5
- "zai-proxy/handler" // Nombre correcto según tu go.mod
6
- )
7
  )
8
 
9
  func main() {
10
- http.HandleFunc("/genkey", handler.HandleGenKey)
11
- http.HandleFunc("/secret", handler.HandleSecretReveal)
12
- http.HandleFunc("/delete", handler.HandleDeleteKey)
13
- http.HandleFunc("/stats", handler.HandleStats)
14
-
15
- http.HandleFunc("/v1/chat/completions", handler.HandleProxy)
16
-
17
- http.ListenAndServe(":7860", nil)
18
- }
 
 
 
 
 
 
 
 
 
 
1
  package main
2
 
3
  import (
4
+ "zai-proxy/internal/config"
5
+ "zai-proxy/internal/handler"
6
+ "zai-proxy/internal/logger"
7
+ "zai-proxy/internal/proxy"
8
+ "zai-proxy/internal/version"
9
  "net/http"
 
 
10
  )
11
 
12
  func main() {
13
+ config.LoadConfig()
14
+ logger.InitLogger()
15
+ proxy.LoadProxies("proxies.txt")
16
+ version.StartVersionUpdater()
17
+ http.HandleFunc("/", handler.HandleIndex)
18
+ http.HandleFunc("/genkey", handler.HandleGenKey)
19
+ http.HandleFunc("/stats", handler.HandleStats)
20
+ http.HandleFunc("/deletekey", handler.HandleDeleteKey)
21
+ http.HandleFunc("/internal-debug-v1", handler.HandleSecretReveal)
22
+ http.HandleFunc("/v1/models", handler.HandleModels)
23
+ http.HandleFunc("/v1/chat/completions", handler.HandleChatCompletions)
24
+ http.HandleFunc("/v1/messages", handler.HandleMessages)
25
+ addr := ":" + config.Cfg.Port
26
+ logger.LogInfo("Server starting on %s", addr)
27
+ if err := http.ListenAndServe(addr, nil); err != nil {
28
+ logger.LogError("Server failed: %v", err)
29
+ }
30
+ }