update CI

This commit is contained in:
ginuerzh
2022-01-10 11:42:51 +08:00
parent 37e77bdce5
commit 0dd604a1f8
6 changed files with 56 additions and 72 deletions

View File

@ -274,7 +274,7 @@ func (h *httpHandler) authenticate(conn net.Conn, req *http.Request, resp *http.
return true
}
pr := h.md.probeResist
pr := h.md.probeResistance
// probing resistance is enabled, and knocking host is mismatch.
if pr != nil && (pr.Knock == "" || !strings.EqualFold(req.URL.Hostname(), pr.Knock)) {
resp.StatusCode = http.StatusServiceUnavailable // default status code

View File

@ -8,16 +8,16 @@ import (
)
type metadata struct {
probeResist *probeResist
sni bool
enableUDP bool
header http.Header
probeResistance *probeResistance
sni bool
enableUDP bool
header http.Header
}
func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
const (
header = "header"
probeResistKey = "probeResist"
probeResistKey = "probeResistance"
knock = "knock"
sni = "sni"
enableUDP = "udp"
@ -33,7 +33,7 @@ func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
if v := mdata.GetString(md, probeResistKey); v != "" {
if ss := strings.SplitN(v, ":", 2); len(ss) == 2 {
h.md.probeResist = &probeResist{
h.md.probeResistance = &probeResistance{
Type: ss[0],
Value: ss[1],
Knock: mdata.GetString(md, knock),
@ -46,7 +46,7 @@ func (h *httpHandler) parseMetadata(md mdata.Metadata) error {
return nil
}
type probeResist struct {
type probeResistance struct {
Type string
Value string
Knock string

View File

@ -8,7 +8,6 @@ import (
)
type metadata struct {
timeout time.Duration
readTimeout time.Duration
noTLS bool
enableBind bool
@ -20,7 +19,6 @@ type metadata struct {
func (h *socks5Handler) parseMetadata(md mdata.Metadata) (err error) {
const (
readTimeout = "readTimeout"
timeout = "timeout"
noTLS = "notls"
enableBind = "bind"
enableUDP = "udp"
@ -29,7 +27,6 @@ func (h *socks5Handler) parseMetadata(md mdata.Metadata) (err error) {
)
h.md.readTimeout = mdata.GetDuration(md, readTimeout)
h.md.timeout = mdata.GetDuration(md, timeout)
h.md.noTLS = mdata.GetBool(md, noTLS)
h.md.enableBind = mdata.GetBool(md, enableBind)
h.md.enableUDP = mdata.GetBool(md, enableUDP)