mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-10 07:07:57 -05:00
Setup discord example to show how to increase max transcript size. (#485)
This commit is contained in:
@@ -17,13 +17,18 @@ use tlsn_prover::tls::{Prover, ProverConfig};
|
||||
// Setting of the application server
|
||||
const SERVER_DOMAIN: &str = "discord.com";
|
||||
|
||||
// Setting of the notary server — make sure these are the same with those in ../../../notary-server
|
||||
// Setting of the notary server — make sure these are the same with the config in ../../../notary-server
|
||||
const NOTARY_HOST: &str = "127.0.0.1";
|
||||
const NOTARY_PORT: u16 = 7047;
|
||||
|
||||
// Configuration of notarization
|
||||
const NOTARY_MAX_SENT: usize = 1 << 12;
|
||||
const NOTARY_MAX_RECV: usize = 1 << 14;
|
||||
// P/S: If the following limits are increased, please ensure max-transcript-size of
|
||||
// the notary server's config (../../../notary-server) is increased too, where
|
||||
// max-transcript-size = MAX_SENT_DATA + MAX_RECV_DATA
|
||||
//
|
||||
// Maximum number of bytes that can be sent from prover to server
|
||||
const MAX_SENT_DATA: usize = 1 << 12;
|
||||
// Maximum number of bytes that can be received by prover from server
|
||||
const MAX_RECV_DATA: usize = 1 << 14;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
@@ -38,8 +43,8 @@ async fn main() {
|
||||
let (notary_tls_socket, session_id) = request_notarization(
|
||||
NOTARY_HOST,
|
||||
NOTARY_PORT,
|
||||
Some(NOTARY_MAX_SENT),
|
||||
Some(NOTARY_MAX_RECV),
|
||||
Some(MAX_SENT_DATA),
|
||||
Some(MAX_RECV_DATA),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -47,6 +52,8 @@ async fn main() {
|
||||
let config = ProverConfig::builder()
|
||||
.id(session_id)
|
||||
.server_dns(SERVER_DOMAIN)
|
||||
.max_sent_data(MAX_SENT_DATA)
|
||||
.max_recv_data(MAX_RECV_DATA)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -19,14 +19,10 @@ const SERVER_DOMAIN: &str = "twitter.com";
|
||||
const ROUTE: &str = "i/api/1.1/dm/conversation";
|
||||
const USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||
|
||||
// Setting of the notary server — make sure these are the same with those in ../../../notary-server
|
||||
// Setting of the notary server — make sure these are the same with the config in ../../../notary-server
|
||||
const NOTARY_HOST: &str = "127.0.0.1";
|
||||
const NOTARY_PORT: u16 = 7047;
|
||||
|
||||
// Configuration of notarization
|
||||
const NOTARY_MAX_SENT: usize = 1 << 12;
|
||||
const NOTARY_MAX_RECV: usize = 1 << 14;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
tracing_subscriber::fmt::init();
|
||||
@@ -38,13 +34,8 @@ async fn main() {
|
||||
let access_token = env::var("ACCESS_TOKEN").unwrap();
|
||||
let csrf_token = env::var("CSRF_TOKEN").unwrap();
|
||||
|
||||
let (notary_tls_socket, session_id) = request_notarization(
|
||||
NOTARY_HOST,
|
||||
NOTARY_PORT,
|
||||
Some(NOTARY_MAX_SENT),
|
||||
Some(NOTARY_MAX_RECV),
|
||||
)
|
||||
.await;
|
||||
let (notary_tls_socket, session_id) =
|
||||
request_notarization(NOTARY_HOST, NOTARY_PORT, None, None).await;
|
||||
|
||||
// Basic default prover config using the session_id returned from /session endpoint just now
|
||||
let config = ProverConfig::builder()
|
||||
|
||||
Reference in New Issue
Block a user