in Sources/NIOSOCKS/State/ServerStateMachine.swift [122:142]
mutating func sendAuthenticationMethod(_ selected: SelectedAuthenticationMethod) throws {
switch self.state {
case .waitingToSendAuthenticationMethod:
()
case .inactive,
.waitingForClientGreeting,
.authenticating,
.waitingForClientRequest,
.waitingToSendResponse,
.active,
.error:
throw SOCKSError.InvalidServerState()
}
self.authenticationMethod = selected.method
if selected.method == .noneRequired {
self.state = .waitingForClientRequest
} else {
self.state = .authenticating
}
}