':param fail_early: If true, a SocksError will be raised if the first byte does not indicate socks5.'

@classmethod
def from_file(cls, f, fail_early=False):

    (ver, nmethods) = struct.unpack('!BB', f.safe_read(2))
    client_greeting = cls(ver, [])
    if fail_early:
        client_greeting.assert_socks5()
    client_greeting.methods.frombytes(f.safe_read(nmethods))
    return client_greeting
