forked from Harry-zklcdc/go-proxy-bingai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (33 loc) · 1.11 KB
/
main.go
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
package main
import (
"adams549659584/go-proxy-bingai/api"
v1 "adams549659584/go-proxy-bingai/api/v1"
"adams549659584/go-proxy-bingai/common"
"log"
"net/http"
"time"
)
func main() {
http.HandleFunc("/v1/chat/completions", v1.ChatHandler)
http.HandleFunc("/v1/images/generations", v1.ImageHandler)
http.HandleFunc("/v1/models/", v1.ModelHandler)
http.HandleFunc("/v1/models", v1.ModelsHandler)
http.HandleFunc("/api/v1/chat/completions", v1.ChatHandler)
http.HandleFunc("/api/v1/images/generations", v1.ImageHandler)
http.HandleFunc("/api/v1/models/", v1.ModelHandler)
http.HandleFunc("/api/v1/models", v1.ModelsHandler)
http.HandleFunc("/sysconf", api.SysConf)
http.HandleFunc("/pass", api.BypassHandler)
http.HandleFunc("/turing/captcha/challenge", api.ChallengeHandler)
http.HandleFunc("/sydney/", api.Sydney)
http.HandleFunc("/web/", api.WebStatic)
http.HandleFunc("/", api.Index)
addr := ":" + common.PORT
log.Println("Starting BingAI Proxy At " + addr)
srv := &http.Server{
Addr: addr,
WriteTimeout: 5 * time.Minute,
ReadTimeout: 15 * time.Second,
}
log.Fatal(srv.ListenAndServe())
}