remove duplicated methods

pull/362/head
Darien Raymond 2017-01-05 16:07:34 +01:00
parent 5e7e549ec1
commit b9fb670ca6
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 1 additions and 6 deletions

View File

@ -104,7 +104,7 @@ func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol
if err != nil {
return nil, errors.Base(err).Message("Socks|Server: Failed to read username or password.")
}
if !s.validate(username, password) {
if !s.config.HasAccount(username, password) {
writeSocks5AuthenticationResponse(writer, 0xFF)
return nil, errors.Base(err).Message("Socks|Server: Invalid username or password.")
}
@ -186,11 +186,6 @@ func (s *ServerSession) Handshake(reader io.Reader, writer io.Writer) (*protocol
return nil, errors.New("Socks|Server: Unknown Socks version: ", version)
}
func (s *ServerSession) validate(username, password string) bool {
p, found := s.config.Accounts[username]
return found && p == password
}
func readUsernamePassword(reader io.Reader) (string, string, error) {
buffer := buf.NewLocal(512)
defer buffer.Release()