mirror of
https://github.com/MetaCubeX/Clash.Meta.git
synced 2025-04-18 08:20:53 +00:00
chore: fix typo
This commit is contained in:
parent
6955fd7e28
commit
57a295da55
6 changed files with 8 additions and 8 deletions
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
errVehicleType = errors.New("unsupport vehicle type")
|
||||
errVehicleType = errors.New("unsupported vehicle type")
|
||||
errSubPath = errors.New("path is not subpath of home directory")
|
||||
)
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ type RawSniffingConfig struct {
|
|||
type RawTLS struct {
|
||||
Certificate string `yaml:"certificate" json:"certificate"`
|
||||
PrivateKey string `yaml:"private-key" json:"private-key"`
|
||||
CustomTrustCert []string `yaml:"custom-certifactes" json:"custom-certifactes"`
|
||||
CustomTrustCert []string `yaml:"custom-certificates" json:"custom-certificates"`
|
||||
}
|
||||
|
||||
type RawConfig struct {
|
||||
|
|
|
@ -48,7 +48,7 @@ ipv6: true # 开启 IPv6 总开关,关闭阻断所有 IPv6 链接和屏蔽 DNS
|
|||
tls:
|
||||
certificate: string # 证书 PEM 格式,或者 证书的路径
|
||||
private-key: string # 证书对应的私钥 PEM 格式,或者私钥路径
|
||||
custom-certifactes:
|
||||
custom-certificates:
|
||||
- |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
format/pem...
|
||||
|
|
|
@ -245,7 +245,7 @@ func setPrivateNetworkAccess(next http.Handler) http.Handler {
|
|||
})
|
||||
}
|
||||
|
||||
func safeEuqal(a, b string) bool {
|
||||
func safeEqual(a, b string) bool {
|
||||
aBuf := utils.ImmutableBytesFromString(a)
|
||||
bBuf := utils.ImmutableBytesFromString(b)
|
||||
return subtle.ConstantTimeCompare(aBuf, bBuf) == 1
|
||||
|
@ -257,7 +257,7 @@ func authentication(secret string) func(http.Handler) http.Handler {
|
|||
// Browser websocket not support custom header
|
||||
if r.Header.Get("Upgrade") == "websocket" && r.URL.Query().Get("token") != "" {
|
||||
token := r.URL.Query().Get("token")
|
||||
if !safeEuqal(token, secret) {
|
||||
if !safeEqual(token, secret) {
|
||||
render.Status(r, http.StatusUnauthorized)
|
||||
render.JSON(w, r, ErrUnauthorized)
|
||||
return
|
||||
|
@ -270,7 +270,7 @@ func authentication(secret string) func(http.Handler) http.Handler {
|
|||
bearer, token, found := strings.Cut(header, " ")
|
||||
|
||||
hasInvalidHeader := bearer != "Bearer"
|
||||
hasInvalidSecret := !found || !safeEuqal(token, secret)
|
||||
hasInvalidSecret := !found || !safeEqual(token, secret)
|
||||
if hasInvalidHeader || hasInvalidSecret {
|
||||
render.Status(r, http.StatusUnauthorized)
|
||||
render.JSON(w, r, ErrUnauthorized)
|
||||
|
|
|
@ -224,7 +224,7 @@ func (c *packet) Data() []byte {
|
|||
return c.buff.Bytes()
|
||||
}
|
||||
|
||||
// WriteBack wirtes UDP packet with source(ip, port) = `addr`
|
||||
// WriteBack writes UDP packet with source(ip, port) = `addr`
|
||||
func (c *packet) WriteBack(b []byte, addr net.Addr) (n int, err error) {
|
||||
if addr == nil {
|
||||
err = errors.New("address is invalid")
|
||||
|
|
|
@ -109,7 +109,7 @@ func WriteHeader(conn net.Conn, host string, port uint, version int) error {
|
|||
|
||||
func WriteUDPHeader(conn net.Conn, version int) error {
|
||||
if version < Version3 {
|
||||
return errors.New("unsupport UDP version")
|
||||
return errors.New("unsupported UDP version")
|
||||
}
|
||||
|
||||
// version, command, clientID length
|
||||
|
|
Loading…
Add table
Reference in a new issue