mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-09-20 23:16:01 +00:00
.github
app
core
extras
auth
command.go
http.go
http_test.go
http_test.py
password.go
password_test.go
userpass.go
userpass_test.go
correctnet
masq
obfs
outbounds
trafficlogger
transport
go.mod
go.sum
media-kit
scripts
.gitignore
CHANGELOG.md
Dockerfile
LICENSE.md
PROTOCOL.md
README.md
go.work
go.work.sum
hyperbole.py
logo.svg
platforms.txt
23 lines
477 B
Go
23 lines
477 B
Go
package auth
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/apernet/hysteria/core/server"
|
|
)
|
|
|
|
var _ server.Authenticator = &PasswordAuthenticator{}
|
|
|
|
// PasswordAuthenticator is a simple authenticator that checks the password against a single string.
|
|
type PasswordAuthenticator struct {
|
|
Password string
|
|
}
|
|
|
|
func (a *PasswordAuthenticator) Authenticate(addr net.Addr, auth string, tx uint64) (ok bool, id string) {
|
|
if auth == a.Password {
|
|
return true, "user"
|
|
} else {
|
|
return false, ""
|
|
}
|
|
}
|