Files
.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
hysteria-dev/extras/auth/password.go
2023-05-25 20:24:24 -07:00

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, ""
}
}