-
-bool send_id(connection_t *c) {
- gettimeofday(&c->start, NULL);
-
- int minor = 0;
-
- if(experimental) {
- if(c->config_tree && !read_ecdsa_public_key(c))
- minor = 1;
- else
- minor = myself->connection->protocol_minor;
- }
-
- return send_request(c, "%d %s %d.%d", ID, myself->connection->name, myself->connection->protocol_major, minor);
-}
-
-bool id_h(connection_t *c, char *request) {
- char name[MAX_STRING_SIZE];
-
- if(sscanf(request, "%*d " MAX_STRING " %d.%d", name, &c->protocol_major, &c->protocol_minor) < 2) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "ID", c->name,
- c->hostname);
- return false;
- }
-
- /* Check if this is a control connection */
-
- if(name[0] == '^' && !strcmp(name + 1, controlcookie)) {
- c->status.control = true;
- c->allow_request = CONTROL;
- c->last_ping_time = time(NULL) + 3600;
-
- free(c->name);
- c->name = xstrdup("<control>");
-
- return send_request(c, "%d %d %d", ACK, TINC_CTL_VERSION_CURRENT, getpid());
- }
-
- /* Check if identity is a valid name */
-
- if(!check_id(name)) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s): %s", "ID", c->name,
- c->hostname, "invalid name");
- return false;
- }
-
- /* If this is an outgoing connection, make sure we are connected to the right host */
-
- if(c->outgoing) {
- if(strcmp(c->name, name)) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Peer %s is %s instead of %s", c->hostname, name,
- c->name);
- return false;
+#include "ed25519/sha512.h"
+
+static bool send_proxyrequest(connection_t *c) {
+ switch(mesh->proxytype) {
+ case PROXY_HTTP: {
+ char *host;
+ char *port;
+
+ sockaddr2str(&c->address, &host, &port);
+ send_request(c, "CONNECT %s:%s HTTP/1.1\r\n\r", host, port);
+ free(host);
+ free(port);
+ return true;