github.com/ava-labs/avalanchego@v1.11.11/proto/http/http.proto (about) 1 syntax = "proto3"; 2 3 package http; 4 5 import "google/protobuf/empty.proto"; 6 7 option go_package = "github.com/ava-labs/avalanchego/proto/pb/http"; 8 9 service HTTP { 10 // Handle wraps http1 over http2 and provides support for websockets by implementing 11 // net conn and responsewriter in http2. 12 rpc Handle(HTTPRequest) returns (google.protobuf.Empty); 13 // HandleSimple wraps http1 requests over http2 similar to Handle but only passes headers 14 // and body bytes. Because the request and response are single protos with no inline 15 // gRPC servers the CPU cost as well as file descriptor overhead is less 16 // (no additional goroutines). 17 rpc HandleSimple(HandleSimpleHTTPRequest) returns (HandleSimpleHTTPResponse); 18 } 19 20 // URL is a net.URL see: https://pkg.go.dev/net/url#URL 21 message URL { 22 // scheme is the url scheme name 23 string scheme = 1; 24 // opaque is encoded opaque data 25 string opaque = 2; 26 // user is username and password information 27 Userinfo user = 3; 28 // host can be in the format host or host:port 29 string host = 4; 30 // path (relative paths may omit leading slash) 31 string path = 5; 32 // raw_path is encoded path hint (see EscapedPath method) 33 string raw_path = 6; 34 // force is append a query ('?') even if RawQuery is empty 35 bool force_query = 7; 36 // raw_query is encoded query values, without '?' 37 string raw_query = 8; 38 // fragment is fragment for references, without '#' 39 string fragment = 9; 40 } 41 42 // UserInfo is net.Userinfo see: https://pkg.go.dev/net/url#Userinfo 43 message Userinfo { 44 // username is the username for the user 45 string username = 1; 46 // password is the password for the user 47 string password = 2; 48 // password_set is a boolean which is true if the password is set 49 bool password_set = 3; 50 } 51 52 message Element { 53 // key is a element key in a key value pair 54 string key = 1; 55 // values are a list of strings corresponding to the key 56 repeated string values = 2; 57 } 58 59 message Certificates { 60 // cert is the certificate body 61 repeated bytes cert = 1; 62 } 63 64 // ConnectionState is tls.ConnectionState see: https://pkg.go.dev/crypto/tls#ConnectionState 65 message ConnectionState { 66 // version is the TLS version used by the connection (e.g. VersionTLS12) 67 uint32 version = 1; 68 // handshake_complete is true if the handshake has concluded 69 bool handshake_complete = 2; 70 // did_resume is true if this connection was successfully resumed from a 71 // previous session with a session ticket or similar mechanism 72 bool did_resume = 3; 73 // cipher_suite is the cipher suite negotiated for the connection 74 uint32 cipher_suite = 4; 75 // negotiated_protocol is the application protocol negotiated with ALPN 76 string negotiated_protocol = 5; 77 // server_name is the value of the Server Name Indication extension sent by 78 // the client 79 string server_name = 6; 80 // peer_certificates are the parsed certificates sent by the peer, in the 81 // order in which they were sent 82 Certificates peer_certificates = 7; 83 // verified_chains is a list of one or more chains where the first element is 84 // PeerCertificates[0] and the last element is from Config.RootCAs (on the 85 // client side) or Config.ClientCAs (on the server side). 86 repeated Certificates verified_chains = 8; 87 // signed_certificate_timestamps is a list of SCTs provided by the peer 88 // through the TLS handshake for the leaf certificate, if any 89 repeated bytes signed_certificate_timestamps = 9; 90 // ocsp_response is a stapled Online Certificate Status Protocol (OCSP) 91 // response provided by the peer for the leaf certificate, if any. 92 bytes ocsp_response = 10; 93 } 94 95 // Request is an http.Request see: https://pkg.go.dev/net/http#Request 96 message Request { 97 // method specifies the HTTP method (GET, POST, PUT, etc.) 98 string method = 1; 99 // url specifies either the URI being requested (for server requests) 100 // or the URL to access (for client requests) 101 URL url = 2; 102 // proto is the protocol version for incoming server requests 103 string proto = 3; 104 // proto_major is the major version 105 int32 proto_major = 4; 106 // proto_minor is the minor version 107 int32 proto_minor = 5; 108 // header contains the request header fields either received 109 // by the server or to be sent by the client 110 repeated Element header = 6; 111 // body is the request payload in bytes 112 bytes body = 7; 113 // content_length records the length of the associated content 114 int64 content_length = 8; 115 // transfer_encoding lists the transfer encodings from outermost to 116 // innermost 117 repeated string transfer_encoding = 9; 118 // host specifies the host on which the URL is sought 119 string host = 10; 120 // form contains the parsed form data, including both the URL 121 // field's query parameters and the PATCH, POST, or PUT form data 122 repeated Element form = 11; 123 // post_form contains the parsed form data from PATCH, POST 124 // or PUT body parameters 125 repeated Element post_form = 12; 126 // trailer_keys specifies additional headers that are sent after the request 127 repeated string trailer_keys = 13; 128 // remote_addr allows HTTP servers and other software to record 129 // the network address that sent the request 130 string remote_addr = 14; 131 // request_uri is the unmodified request-target 132 string request_uri = 15; 133 // tls connection state 134 ConnectionState tls = 16; 135 } 136 137 message ResponseWriter { 138 // header returns the header map that will be sent by 139 // WriteHeader. 140 repeated Element header = 1; 141 // server_addr is the address of the gRPC server hosting the Writer service 142 string server_addr = 2; 143 } 144 145 message HTTPRequest { 146 // response_writer is used by an HTTP handler to construct an HTTP response 147 ResponseWriter response_writer = 1; 148 // request is an http request 149 Request request = 2; 150 } 151 152 message HandleSimpleHTTPRequest { 153 // method specifies the HTTP method (GET, POST, PUT, etc.) 154 string method = 1; 155 // url specifies either the URI being requested 156 string url = 2; 157 // headers contains the request header fields either received 158 // by the server or to be sent by the client 159 repeated Element headers = 3; 160 // body is the request payload in bytes 161 bytes body = 4; 162 } 163 164 message HandleSimpleHTTPResponse { 165 // code is the response code 166 int32 code = 1; 167 // headers contains the request header fields either received 168 // by the server or to be sent by the client 169 repeated Element headers = 2; 170 // body is the response payload in bytes 171 bytes body = 3; 172 }