Skip to content

Commit

Permalink
Update protos + add router.proto
Browse files Browse the repository at this point in the history
  • Loading branch information
pycanis committed Sep 11, 2024
1 parent fac4a67 commit d3e23cc
Show file tree
Hide file tree
Showing 7 changed files with 2,492 additions and 121 deletions.
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn main() -> std::io::Result<()> {
"lightning.proto",
"peersrpc/peers.proto",
"verrpc/verrpc.proto",
"routerrpc/router.proto"
];

let proto_paths: Vec<_> = protos
Expand Down
16 changes: 15 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ pub type VersionerClient =
// Convenience type alias for signer client.
pub type SignerClient = signrpc::signer_client::SignerClient<InterceptedService<Channel, MacaroonInterceptor>>;

// Convenience type alias for router client.
pub type RouterClient = routerrpc::router_client::RouterClient<InterceptedService<Channel, MacaroonInterceptor>>;

/// The client returned by `connect` function
///
/// This is a convenience type which you most likely want to use instead of raw client.
Expand All @@ -108,6 +111,7 @@ pub struct Client {
signer: SignerClient,
peers: PeersClient,
version: VersionerClient,
router: RouterClient,
}

impl Client {
Expand Down Expand Up @@ -135,6 +139,11 @@ impl Client {
pub fn peers(&mut self) -> &mut PeersClient {
&mut self.peers
}

/// Returns the router client.
pub fn router(&mut self) -> &mut RouterClient {
&mut self.router
}
}

/// [`tonic::Status`] is re-exported as `Error` for convenience.
Expand Down Expand Up @@ -175,6 +184,10 @@ pub mod peersrpc {
tonic::include_proto!("peersrpc");
}

pub mod routerrpc {
tonic::include_proto!("routerrpc");
}

/// Supplies requests with macaroon
#[derive(Clone)]
pub struct MacaroonInterceptor {
Expand Down Expand Up @@ -231,7 +244,8 @@ pub async fn connect<A, CP, MP>(address: A, cert_file: CP, macaroon_file: MP) ->
interceptor.clone(),
),
version: verrpc::versioner_client::VersionerClient::with_interceptor(conn.clone(), interceptor.clone()),
signer: signrpc::signer_client::SignerClient::with_interceptor(conn, interceptor),
signer: signrpc::signer_client::SignerClient::with_interceptor(conn.clone(), interceptor.clone()),
router: routerrpc::router_client::RouterClient::with_interceptor(conn, interceptor),
};
Ok(client)
}
Expand Down
Loading

0 comments on commit d3e23cc

Please sign in to comment.