|
1 | 1 | use canister_test::{RemoteTestRuntime, Runtime};
|
2 | 2 | use clap::Parser;
|
3 | 3 | use ic_base_types::{PrincipalId, SubnetId};
|
4 |
| -use ic_canister_client::{Agent, Sender}; |
| 4 | +use ic_canister_client::{Agent, HttpClientConfig, Sender}; |
5 | 5 | use ic_nns_common::pb::v1::NeuronId;
|
6 | 6 | use ic_nns_constants::REGISTRY_CANISTER_ID;
|
7 | 7 | use ic_nns_governance::pb::v1::Governance as GovernanceProto;
|
@@ -130,6 +130,10 @@ struct CliArgs {
|
130 | 130 | /// Pass specified_id to provisional_create_canister_with_cycles when creating canisters.
|
131 | 131 | #[clap(long)]
|
132 | 132 | pass_specified_id: bool,
|
| 133 | + |
| 134 | + /// If set, HTTP/2 is used for connections to the IC. By default, HTTP/1.1 is used. |
| 135 | + #[clap(long)] |
| 136 | + http2_only: bool, |
133 | 137 | }
|
134 | 138 |
|
135 | 139 | const LOG_PREFIX: &str = "[ic-nns-init] ";
|
@@ -186,15 +190,20 @@ async fn main() {
|
186 | 190 |
|
187 | 191 | let url = args.url.expect("Url must be provided to install canister.");
|
188 | 192 |
|
| 193 | + let http_client_config = HttpClientConfig { |
| 194 | + http2_only: args.http2_only, |
| 195 | + ..HttpClientConfig::default() |
| 196 | + }; |
189 | 197 | let agent = if args.use_hsm {
|
190 | 198 | let sender = make_hsm_sender(&args.hsm_slot, &args.key_id, &args.pin);
|
191 |
| - Agent::new(url.clone(), sender) |
| 199 | + Agent::new_with_http_client_config(url.clone(), sender, http_client_config) |
192 | 200 | } else {
|
193 | 201 | // Use the special identity that has superpowers, like calling
|
194 | 202 | // ic00::Method::ProvisionalCreateCanisterWithCycles.
|
195 |
| - Agent::new( |
| 203 | + Agent::new_with_http_client_config( |
196 | 204 | url.clone(),
|
197 | 205 | Sender::from_keypair(&ic_test_identity::TEST_IDENTITY_KEYPAIR),
|
| 206 | + http_client_config, |
198 | 207 | )
|
199 | 208 | };
|
200 | 209 |
|
|
0 commit comments