syntax = "proto3";

package network;
option go_package="./;network";

import "connect.proto";
import "forward.proto";
import "shell.proto";
import "vnc.proto";
import "code.proto";

message handshake_payload {
    bytes enc = 1;
}

message msg {
    enum type {
        unknown     = 0;
        handshake   = 1;
        keepalive   = 2;
        connect_req = 3;
        connect_rep = 4;
        disconnect  = 5;
        forward     = 6;
        // shell
        shell_resize = 10;
        shell_data   = 11;
        // vnc
        vnc_ctrl      = 20;
        vnc_image     = 21;
        vnc_mouse     = 22;
        vnc_keyboard  = 23;
        vnc_cad       = 24; // ctrl+alt+del
        vnc_scroll    = 25;
        vnc_clipboard = 26;
        // code-server
        code_request          = 30;
        code_response_hdr     = 31;
        code_response_body    = 32;
        code_connect          = 33;
        code_connect_response = 34;
        code_data             = 35;
    }
    type      _type = 1;
    string     from = 2;
    string       to = 4;
    string  link_id = 6;
    oneof payload {
        handshake_payload  hsp = 10;
        connect_request   creq = 11;
        connect_response  crep = 12;
        data             _data = 13;
        // shell
        shell_resize  sresize = 20;
        shell_data      sdata = 21;
        // vnc
        vnc_control        vctrl = 30;
        vnc_image           vimg = 31;
        vnc_mouse         vmouse = 32;
        vnc_keyboard        vkbd = 33;
        vnc_scroll       vscroll = 34;
        vnc_clipboard vclipboard = 35;
        // code-server
        code_request               csreq = 40;
        code_response_header   csrep_hdr = 41;
        code_response_body    csrep_body = 42;
        code_connect              csconn = 43;
        code_connect_response csconn_rep = 44;
        code_data                 csdata = 45;
    }
}