pingora/docs/user_guide/peer.md
Yuchen Wu 8160ad1698 Fix typos and grammar issues
Co-authored-by: =?~~~?q?Ren=C3=A9=20Kla=C4=8Dan?= <rene@klacan.sk>
Co-authored-by: 12932 <68835423+12932@users.noreply.github.com>
Co-authored-by: Alessandro <aleferrara1998@gmail.com>
Co-authored-by: InImpasse <40639475+InImpasse@users.noreply.github.com>
Co-authored-by: Paul James Cleary <pauljamescleary@gmail.com>
Co-authored-by: Yang Hau <yuanyanghau@gmail.com>
Co-authored-by: Morpheus <40785143+Muzych@users.noreply.github.com>
Co-authored-by: mobeicanyue <81098819+mobeicanyue@users.noreply.github.com>
Co-authored-by: Twacqwq <69360546+Twacqwq@users.noreply.github.com>
Co-authored-by: Bobby <zkd8907@live.com>
Co-authored-by: Dup4 <lyuzhi.pan@gmail.com>
Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: Sheldon <1415182877@qq.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: ZhangIvan1 <zhang_ivan1@163.com>
Co-authored-by: GrahamQuan <33834833+GrahamQuan@users.noreply.github.com>
Co-authored-by: =?~~~?q?Cristian=20Paul=20Pe=C3=B1aranda=20Rojas?= <paul@kristianpaul.org>
Co-authored-by: Nathan Sit <nsit.earth@gmail.com>
Co-authored-by: David Lee <67067729+LordMoMA@users.noreply.github.com>
Co-authored-by: Mengliang Su <mengliang.su@shopee.com>
Co-authored-by: =?~~~?q?=EA=B9=80=EC=84=A0=EC=9A=B0?= <seonwoo960000@toss.im>
Co-authored-by: Allen Huang <huangseji@meituan.com>
Co-authored-by: Opacity <70315161+zreren@users.noreply.github.com>
Co-authored-by: cris <sqdcmk@gmail.com>
Co-authored-by: Killian Ye <40255385+ykw1129@users.noreply.github.com>
Co-authored-by: Jiwei-dev <hi.jiwei@gmail.com>
Co-authored-by: Jinfeng Wang <41931794+wjf40390@users.noreply.github.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
2024-03-01 13:47:27 -08:00

2 KiB

Peer: how to connect to upstream

In the upstream_peer() phase the user should return a Peer object which defines how to connect to a certain upstream.

Peer

A HttpPeer defines which upstream to connect to.

attribute meaning
address: SocketAddr The IP:Port to connect to
scheme: Scheme Http or Https
sni: String The SNI to use, Https only
proxy: Option<Proxy> The setting to proxy the request through a CONNECT proxy
client_cert_key: Option<Arc<CertKey>> The client certificate to use in mTLS connections to upstream
options: PeerOptions See below

PeerOptions

A PeerOptions defines how to connect to the upstream.

attribute meaning
bind_to: Option<InetSocketAddr> Which local address to bind to as the client IP
connection_timeout: Option<Duration> How long to wait before giving up establishing a TCP connection
total_connection_timeout: Option<Duration> How long to wait before giving up establishing a connection including TLS handshake time
read_timeout: Option<Duration> How long to wait before each individual read() from upstream. The timer is reset after each read()
idle_timeout: Option<Duration> How long to wait before closing a idle connection waiting for connection reuse
write_timeout: Option<Duration> How long to wait before a write() to upstream finishes
verify_cert: bool Whether to check if upstream' server cert is valid and validated
verify_hostname: bool Whether to check if upstream server cert's CN matches the SNI
alternative_cn: Option<String> Accept the cert if the CN matches this name
alpn: ALPN Which HTTP protocol to advertise during ALPN, http1.1 and/or http2
ca: Option<Arc<Box<[X509]>>> Which Root CA to use to validate the server's cert
tcp_keepalive: Option<TcpKeepalive> TCP keepalive settings to upstream

Examples

TBD