perf(loadbalance): delegate fnvHash64a to internal/hash
Eliminates code duplication, uses shared inline FNV-1a implementation.
This commit is contained in:
parent
c59d387451
commit
71bfb895e5
@ -22,6 +22,8 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"rua.plus/lolly/internal/hash"
|
||||
)
|
||||
|
||||
type filterContext struct {
|
||||
@ -55,12 +57,7 @@ func releaseFilterContext(fc *filterContext) {
|
||||
}
|
||||
|
||||
func fnvHash64a(key string) uint64 {
|
||||
var h uint64 = 14695981039346656037
|
||||
for i := 0; i < len(key); i++ {
|
||||
h ^= uint64(key[i])
|
||||
h *= 1099511628211
|
||||
}
|
||||
return h
|
||||
return hash.FNV64a(key)
|
||||
}
|
||||
|
||||
// Target 表示 HTTP 代理(L7 层)的负载均衡后端服务器目标。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user