Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): support tdesktop #829

Closed
ernado opened this issue Jul 28, 2022 · 3 comments · Fixed by #851
Closed

feat(server): support tdesktop #829

ernado opened this issue Jul 28, 2022 · 3 comments · Fixed by #851
Labels
area: proto MTProto implementation issues epic Feature that is too big for single issue

Comments

@ernado
Copy link
Member

ernado commented Jul 28, 2022

Meta-issue for tdesktop support on server and protocol.

int TcpConnection::Protocol::Version0::readPacketLength(
		bytes::const_span bytes) const {
	if (bytes.empty()) {
		return kUnknownSize;
	}

	const auto first = static_cast<char>(bytes[0]);
	if (first == 0x7F) {
		if (bytes.size() < 4) {
			return kUnknownSize;
		}
		const auto ints = static_cast<uint32>(bytes[1])
			| (static_cast<uint32>(bytes[2]) << 8)
			| (static_cast<uint32>(bytes[3]) << 16);
		return (ints >= 0x7F) ? (int(ints << 2) + 4) : kInvalidSize;
	} else if (first > 0 && first < 0x7F) {
		const auto ints = uint32(first);
		return int(ints << 2) + 1;
	}
	return kInvalidSize;
}

This looks like abridged, but it is currently not working:

  • read: read: read abridged: read payload: unexpected EOF when no header
  • Invalid header with header

Other implementations

cc: @tdakkota

@ernado ernado added area: proto MTProto implementation issues epic Feature that is too big for single issue labels Jul 28, 2022
@ernado ernado pinned this issue Jul 28, 2022
@ernado
Copy link
Member Author

ernado commented Jul 28, 2022

Screenshot from 2022-07-28 13-09-56

@ernado
Copy link
Member Author

ernado commented Jul 28, 2022

[13:12:33.034 02-0002899] Connection 740(dc:1,) Info: Sending 88 len request. (connection_abstract.cpp : 25)
[13:12:33.035 02-0002900] Connection 737(dc:1,127.0.0.1:9443) Info: Sending fake req_pq. (connection_abstract.cpp : 25)
[13:12:33.035 02-0002901] Connection 737(dc:1,127.0.0.1:9443) Info: TCP Info: write packet 77 bytes. (connection_abstract.cpp : 25)

ernado added a commit that referenced this issue Aug 14, 2022
Initial support for tdesktop key exchange.

Fix #829
@ernado
Copy link
Member Author

ernado commented Aug 14, 2022

Thank you for help guys!

@ernado ernado unpinned this issue Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: proto MTProto implementation issues epic Feature that is too big for single issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant