github.com/ava-labs/avalanchego@v1.11.11/proto/http/responsewriter/responsewriter.proto (about)

     1  syntax = "proto3";
     2  
     3  package http.responsewriter;
     4  
     5  import "google/protobuf/empty.proto";
     6  
     7  option go_package = "github.com/ava-labs/avalanchego/proto/pb/http/responsewriter";
     8  
     9  // Writer is an http.ResponseWriter see: https://pkg.go.dev/net/http#ResponseWriter
    10  service Writer {
    11    // Write writes the data to the connection as part of an HTTP reply
    12    rpc Write(WriteRequest) returns (WriteResponse);
    13    // WriteHeader sends an HTTP response header with the provided
    14    // status code
    15    rpc WriteHeader(WriteHeaderRequest) returns (google.protobuf.Empty);
    16    // Flush is a no-op
    17    rpc Flush(google.protobuf.Empty) returns (google.protobuf.Empty);
    18    // Hijack lets the caller take over the connection
    19    rpc Hijack(google.protobuf.Empty) returns (HijackResponse);
    20  }
    21  
    22  message Header {
    23    // key is a element key in a key value pair
    24    string key = 1;
    25    // values are a list of strings coresponding to the key
    26    repeated string values = 2;
    27  }
    28  
    29  message WriteRequest {
    30    // headers represents the key-value pairs in an HTTP header
    31    repeated Header headers = 1;
    32    // payload is the write request in bytes
    33    bytes payload = 2;
    34  }
    35  
    36  message WriteResponse {
    37    // written is the number of bytes written in body
    38    int32 written = 1;
    39  }
    40  
    41  message WriteHeaderRequest {
    42    // headers represents the key-value pairs in an HTTP header
    43    repeated Header headers = 1;
    44    // status_code must be a valid HTTP 1xx-5xx status code
    45    int32 status_code = 2;
    46  }
    47  
    48  message HijackResponse {
    49    // local_network is the name of the network (for example, "tcp", "udp")
    50    string local_network = 1;
    51    // local_string is string form of address
    52    string local_string = 2;
    53    // remote_network is the name of the network (for example, "tcp", "udp")
    54    string remote_network = 3;
    55    // remote_string is string form of address
    56    string remote_string = 4;
    57    // server_addr is the address of the gRPC server serving the Conn, Reader
    58    // and Writer services which facilitate Hijacking
    59    string server_addr = 5;
    60  }