Skip to content

Commit 91985c1

Browse files
authored
chore: typo (MetaCubeX#2127)
1 parent 6a9d428 commit 91985c1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

component/resolver/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func NewHostValueByDomain(domain string) (HostValue, error) {
113113
domain = strings.Trim(domain, ".")
114114
item := strings.Split(domain, ".")
115115
if len(item) < 2 {
116-
return HostValue{}, errors.New("invaild domain")
116+
return HostValue{}, errors.New("invalid domain")
117117
}
118118
return HostValue{
119119
IsDomain: true,

hub/route/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func startPipe(cfg *Config) {
299299
}
300300
}
301301

302-
func safeEuqal(a, b string) bool {
302+
func safeEqual(a, b string) bool {
303303
aBuf := utils.ImmutableBytesFromString(a)
304304
bBuf := utils.ImmutableBytesFromString(b)
305305
return subtle.ConstantTimeCompare(aBuf, bBuf) == 1
@@ -311,7 +311,7 @@ func authentication(secret string) func(http.Handler) http.Handler {
311311
// Browser websocket not support custom header
312312
if r.Header.Get("Upgrade") == "websocket" && r.URL.Query().Get("token") != "" {
313313
token := r.URL.Query().Get("token")
314-
if !safeEuqal(token, secret) {
314+
if !safeEqual(token, secret) {
315315
render.Status(r, http.StatusUnauthorized)
316316
render.JSON(w, r, ErrUnauthorized)
317317
return
@@ -324,7 +324,7 @@ func authentication(secret string) func(http.Handler) http.Handler {
324324
bearer, token, found := strings.Cut(header, " ")
325325

326326
hasInvalidHeader := bearer != "Bearer"
327-
hasInvalidSecret := !found || !safeEuqal(token, secret)
327+
hasInvalidSecret := !found || !safeEqual(token, secret)
328328
if hasInvalidHeader || hasInvalidSecret {
329329
render.Status(r, http.StatusUnauthorized)
330330
render.JSON(w, r, ErrUnauthorized)

0 commit comments

Comments
 (0)