mirror of https://github.com/bjdgyc/anylink.git
添加 profile name(用于区分不同网站的配置)
This commit is contained in:
parent
cca9e377c5
commit
632080c1d6
|
@ -420,7 +420,8 @@ ipv4_end = "10.1.2.200"
|
|||
|
||||
- [AnyConnect Secure Client](https://www.cisco.com/) (可通过群文件下载: Windows/macOS/Linux/Android/iOS)
|
||||
- [OpenConnect](https://gitlab.com/openconnect/openconnect) (Windows/macOS/Linux)
|
||||
- [AnyLink Secure Client](https://github.com/tlslink/anylink-client) (Windows/macOS/Linux)
|
||||
- [三方 AnyLink Secure Client](https://github.com/tlslink/anylink-client) (Windows/macOS/Linux)
|
||||
- [三方客户端下载地址](https://cisco.yangpin.link) (Windows/macOS/Linux/Android/iOS)
|
||||
|
||||
## Contribution
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ type ServerConfig struct {
|
|||
// LinkAddr string `json:"link_addr"`
|
||||
Conf string `json:"conf"`
|
||||
Profile string `json:"profile"`
|
||||
ProfileName string `json:"profile_name"`
|
||||
ServerAddr string `json:"server_addr"`
|
||||
ServerDTLSAddr string `json:"server_dtls_addr"`
|
||||
ServerDTLS bool `json:"server_dtls"`
|
||||
|
|
|
@ -22,6 +22,7 @@ type config struct {
|
|||
var configs = []config{
|
||||
{Typ: cfgStr, Name: "conf", Usage: "config file", ValStr: "./conf/server.toml", Short: "c"},
|
||||
{Typ: cfgStr, Name: "profile", Usage: "profile.xml file", ValStr: "./conf/profile.xml"},
|
||||
{Typ: cfgStr, Name: "profile_name", Usage: "profile name(用于区分不同网站的配置)", ValStr: "anylink"},
|
||||
{Typ: cfgStr, Name: "server_addr", Usage: "TCP服务监听地址(任意端口)", ValStr: ":443"},
|
||||
{Typ: cfgBool, Name: "server_dtls", Usage: "开启DTLS", ValBool: false},
|
||||
{Typ: cfgStr, Name: "server_dtls_addr", Usage: "DTLS监听地址(任意端口)", ValStr: ":443"},
|
||||
|
|
|
@ -11,6 +11,8 @@ cert_file = "./conf/vpn_cert.pem"
|
|||
cert_key = "./conf/vpn_cert.key"
|
||||
files_path = "./conf/files"
|
||||
profile = "./conf/profile.xml"
|
||||
#profile name(用于区分不同网站的配置)
|
||||
profile_name = "anylink"
|
||||
#日志目录,为空写入标准输出
|
||||
#log_path = "./log"
|
||||
log_path = ""
|
||||
|
|
|
@ -137,7 +137,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
|||
other := &dbdata.SettingOther{}
|
||||
_ = dbdata.SettingGet(other)
|
||||
rd := RequestData{SessionId: sess.Sid, SessionToken: sess.Sid + "@" + sess.Token,
|
||||
Banner: other.Banner, ProfileHash: profileHash}
|
||||
Banner: other.Banner, ProfileName: base.Cfg.ProfileName, ProfileHash: profileHash}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
tplRequest(tpl_complete, w, rd)
|
||||
base.Debug("login", cr.Auth.Username, userAgent)
|
||||
|
@ -175,6 +175,7 @@ type RequestData struct {
|
|||
SessionId string
|
||||
SessionToken string
|
||||
Banner string
|
||||
ProfileName string
|
||||
ProfileHash string
|
||||
}
|
||||
|
||||
|
@ -227,7 +228,7 @@ var auth_complete = `<?xml version="1.0" encoding="UTF-8"?>
|
|||
<vpn-profile-manifest>
|
||||
<vpn rev="1.0">
|
||||
<file type="profile" service-type="user">
|
||||
<uri>/profile.xml</uri>
|
||||
<uri>/profile_{{.ProfileName}}.xml</uri>
|
||||
<hash type="sha1">{{.ProfileHash}}</hash>
|
||||
</file>
|
||||
</vpn>
|
||||
|
|
|
@ -98,7 +98,7 @@ func initRoute() http.Handler {
|
|||
r.HandleFunc("/", LinkAuth).Methods(http.MethodPost)
|
||||
r.HandleFunc("/CSCOSSLC/tunnel", LinkTunnel).Methods(http.MethodConnect)
|
||||
r.HandleFunc("/otp_qr", LinkOtpQr).Methods(http.MethodGet)
|
||||
r.HandleFunc("/profile.xml", func(w http.ResponseWriter, r *http.Request) {
|
||||
r.HandleFunc(fmt.Sprintf("/profile_%s.xml", base.Cfg.ProfileName), func(w http.ResponseWriter, r *http.Request) {
|
||||
b, _ := os.ReadFile(base.Cfg.Profile)
|
||||
w.Write(b)
|
||||
}).Methods(http.MethodGet)
|
||||
|
|
Loading…
Reference in New Issue