mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-05 08:01:10 +00:00
34 lines
653 B
Go
34 lines
653 B
Go
package api
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func firstPathParam(c businessContext, names ...string) string {
|
|
if c == nil {
|
|
return ""
|
|
}
|
|
for _, name := range names {
|
|
if v := strings.TrimSpace(c.Param(name)); v != "" {
|
|
return v
|
|
}
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func deviceIDParam(c businessContext) string {
|
|
return firstPathParam(c, "device_id", "id")
|
|
}
|
|
|
|
func upstreamProxyIDParam(c businessContext) string {
|
|
return firstPathParam(c, "proxy_id", "id")
|
|
}
|
|
|
|
func countryCodeParam(c businessContext) string {
|
|
return firstPathParam(c, "country_code", "country")
|
|
}
|
|
|
|
func proxyInstanceIDParam(c businessContext) string {
|
|
return firstPathParam(c, "instance_id", "id")
|
|
}
|