def Tls.open.route

bend-kube-runtime@0.2.0.0 · src/net.bend:123

import bend-kube-runtime@0.2.0.0/src/net.bend as Net
import Base
import bend-kube-runtime@0.2.0.0/src/proxy.bend as P

123def Tls.open.route(r: P.Route, +host: String, +port: U32, ca: String, cert: String,
124  key: String, +ms: U32) -> IO(Res(Socket)):
125  match r:
126    case P.Direct{}:
127      IO.bind(Res(Socket), Res(Socket), Tls.dial(host, port, ms),
128        d => Tls.open.direct(d, host, ca, cert, key, ms))
129    case P.Via{P.Proxy{ph, pp, auth}}:
130      IO.bind(Res(Socket), Res(Socket), Tls.dial(ph, pp, ms),
131        d => Tls.open.proxied(d, P.Proxy.connect(host, port, auth), host, ca, cert, key, ms))
132    case P.NoRoute{why}:
133      IO.pure(Res(Socket), Fail{(22, why)})

Uses (15)

Used by (1)