-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathtls.rs
63 lines (59 loc) · 1.97 KB
/
tls.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use bytes::Bytes;
use pyo3::{
pymethods,
types::PyByteArray,
PyRefMut,
};
use crate::listener_builder::TlsListenerBuilder;
#[pymethods]
#[allow(dead_code)]
impl TlsListenerBuilder {
/// The domain to request for this edge, any valid domain or hostname that you have
/// previously registered with ngrok. If using a custom domain, this requires
/// registering in the `ngrok dashboard`_ and setting a DNS CNAME value.
///
/// .. _ngrok dashboard: https://dashboard.ngrok.com/cloud-edge/domains
pub fn domain(self_: PyRefMut<Self>, domain: String) -> PyRefMut<Self> {
self_.set(|b| {
b.domain(domain);
});
self_
}
/// Certificates to use for client authentication at the ngrok edge.
/// See `Mutual TLS`_ in the ngrok docs for additional details.
///
/// .. _Mutual TLS: https://ngrok.com/docs/cloud-edge/modules/mutual-tls/
pub fn mutual_tlsca<'a>(
self_: PyRefMut<'a, Self>,
mutual_tlsca: &PyByteArray,
) -> PyRefMut<'a, Self> {
self_.set(|b| {
b.mutual_tlsca(Bytes::from(mutual_tlsca.to_vec()));
});
self_
}
/// Enable endpoint pooling for this listener.
pub fn pooling_enabled(self_: PyRefMut<Self>, endpoint_pooling: bool) -> PyRefMut<Self> {
self_.set(|b| {
b.pooling_enabled(endpoint_pooling);
});
self_
}
/// The key to use for TLS termination at the ngrok edge in PEM format.
/// See `TLS Termination`_ in the ngrok docs for additional details.
///
/// .. _TLS Termination: https://ngrok.com/docs/cloud-edge/modules/tls-termination/
pub fn termination<'a>(
self_: PyRefMut<'a, Self>,
cert_pem: &PyByteArray,
key_pem: &PyByteArray,
) -> PyRefMut<'a, Self> {
self_.set(|b| {
b.termination(
Bytes::from(cert_pem.to_vec()),
Bytes::from(key_pem.to_vec()),
);
});
self_
}
}