mirror of
https://github.com/fatedier/frp.git
synced 2025-07-28 16:37:39 +00:00
code optimization (#3625)
This commit is contained in:
@@ -45,38 +45,3 @@ func Major(v string) int64 {
|
||||
func Minor(v string) int64 {
|
||||
return getSubVersion(v, 2)
|
||||
}
|
||||
|
||||
// add every case there if server will not accept client's protocol and return false
|
||||
func Compat(client string) (ok bool, msg string) {
|
||||
if LessThan(client, "0.18.0") {
|
||||
return false, "Please upgrade your frpc version to at least 0.18.0"
|
||||
}
|
||||
return true, ""
|
||||
}
|
||||
|
||||
func LessThan(client string, server string) bool {
|
||||
vc := Proto(client)
|
||||
vs := Proto(server)
|
||||
if vc > vs {
|
||||
return false
|
||||
} else if vc < vs {
|
||||
return true
|
||||
}
|
||||
|
||||
vc = Major(client)
|
||||
vs = Major(server)
|
||||
if vc > vs {
|
||||
return false
|
||||
} else if vc < vs {
|
||||
return true
|
||||
}
|
||||
|
||||
vc = Minor(client)
|
||||
vs = Minor(server)
|
||||
if vc > vs {
|
||||
return false
|
||||
} else if vc < vs {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user