<commit_before>#include "s5.h"
#include "core.h"

#include <stdio.h>



ctx_state_t 
s5_client_do_next(struct context *ctx) {
    printf("%s switch to forward conext", ctx->peername);
}

ctx_state_t
s5_client_handshake() {
    
}

ctx_state_t
s5_client_auth() {

}

<commit_msg>millstone: begin socks5 protocol client-side<commit_after>#include "s5.h"
#include "core.h"

#include <stdio.h>




static ctx_state_t
s5_do_handshake(struct context *ctx) {
    rps_status_t status;
    ctx_state_t new_state;
    struct session  *sess;
    struct s5_method_request req;

    sess = ctx->sess;

    req.ver = SOCKS5_VERSION;
    if (string_empty(&sess->upstream.uname)) {
        req.nmethods = 1;
        req.methods[0] = 0x00;
        status = server_write(ctx, &req, 3);
    } else {
        req.nmethods = 2;
        req.methods[0] = 0x00;
        req.methods[1] = 0x02;
        status = server_write(ctx, &req, 4);
    }

    if (status != RPS_OK) {
        return c_kill;
    }
    
    return c_handshake_reply;
}

static ctx_state_t
s5_do_handshake_reply(struct context *ctx) {
    printf("cliet into do handshake reply phase\n");
    return c_requests;
}



static ctx_state_t
s5_do_auth() {

}


ctx_state_t 
s5_client_do_next(struct context *ctx) {
    ctx_state_t new_state;

    switch(ctx->state) {
        case c_handshake:
            new_state = s5_do_handshake(ctx);
            break;
        case c_handshake_reply:
            new_state = s5_do_handshake_reply(ctx);
            break;
        default:
            NOT_REACHED();
            new_state = c_kill;
    }

    return new_state;
    
}
{'fraction_non_alphanumeric': 0.10732009925558313, 'fraction_numerical': 0.018610421836228287, 'mean_word_length': 2.5924276169265035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4515304', 'n_tokens_mistral': 630, 'n_tokens_neox': 604, 'n_words': 116}