Net.Tls.tunnel: def of bend-kube-runtime@0.2.0.0 Import: import bend-kube-runtime@0.2.0.0/src/net.bend as Net Lines 77-96 of bend-kube-runtime@0.2.0.0/src/net.bend: https://jend.leeeet.dev/read.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&start_line=77&end_line=96 import Base import bend-kube-runtime@0.2.0.0/src/proxy.bend as P # Reads the proxy's answer to CONNECT; once it opens the tunnel, secures # the connection end to end with the API server. def Tls.tunnel(fuel: Nat, ev: TunEv, +host: String, ca: String, cert: String, key: String, +ms: U32) -> IO(Res(Socket)): match fuel ev: case 0n TGot{s, r, st}: Tls.fail(s, (0, "proxy: answer too long")) case 0n TStep{s, st}: Tls.fail(s, (0, "proxy: answer too long")) case 1n+f TGot{s, Done{bs}, st}: Tls.tunnel(f, TStep{s, P.Tunnel.feed(st, bs)}, host, ca, cert, key, ms) case 1n+f TGot{s, Fail{(c, m)}, st}: Tls.fail(s, (c, "proxy: " ++ m)) case 1n+f TStep{s, P.TMore{h}}: IO.bind(Socket & Res(List<&2, U32>), Res(Socket), Tls.recv(s, 4096, ms), p => Tls.tunnel(f, TunEv.got(p, P.TMore{h}), host, ca, cert, key, ms)) case 1n+f TStep{s, P.TOpen{}}: Tls.secure(s, host, ca, cert, key, ms) case 1n+f TStep{s, P.TFail{why}}: Tls.fail(s, (0, why)) Uses (19): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Socket https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=Res https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=Tls.fail https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=Tls.recv https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=Tls.secure https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=TunEv https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=TunEv.got https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/proxy.bend&name=Tunnel https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/proxy.bend&name=Tunnel.feed