-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1242da
commit 58f5443
Showing
11 changed files
with
612 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,16 @@ | ||
use adnl::{AdnlPeer, AdnlRawPublicKey}; | ||
use tokio_tower::multiplex; | ||
use ton_liteapi::layers::WrapMessagesLayer; | ||
use ton_liteapi::peer::LitePeer; | ||
use ton_liteapi::tl::request::{Request, WrappedRequest}; | ||
use tower::{Service, ServiceBuilder, ServiceExt}; | ||
use ton_liteapi::client::LiteClient; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
env_logger::init(); | ||
let server_public = AdnlRawPublicKey::try_from(&*hex::decode("691a14528fb2911839649c489cb4cbec1f4aa126c244c0ea2ac294eb568a7037")?)?; | ||
let ls_ip = "127.0.0.1"; | ||
let ls_port: u16 = 8080; | ||
let adnl = AdnlPeer::connect(&server_public, (ls_ip, ls_port)).await?; | ||
let lite = LitePeer::new(adnl); | ||
let mut service = ServiceBuilder::new() | ||
.layer(WrapMessagesLayer) | ||
.service(multiplex::Client::<_, Box<dyn std::error::Error + Send + Sync + 'static>, _>::new(lite)); | ||
let message = WrappedRequest { wait_masterchain_seqno: None, request: Request::GetTime }; | ||
let result = service.ready().await?.call(message.clone()).await?; | ||
let server_public = hex::decode("9f69357376ad875d1543faea6f0bb9fbcd283521b743b1c0d2d432587fe9dbae")?; | ||
let server_address = ("127.0.0.1", 8080); | ||
let mut liteclient = LiteClient::connect(server_address, server_public).await?; | ||
let result = liteclient.get_time().await?; | ||
println!("{:?}", result); | ||
let result = service.ready().await?.call(message.clone()).await?; | ||
let result = liteclient.get_time().await?; | ||
println!("{:?}", result); | ||
let result = service.ready().await?.call(message.clone()).await?; | ||
let result = liteclient.get_time().await?; | ||
println!("{:?}", result); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.