def ssl.byte
bend-kit-postgres@0.3.0.0 · postgres.bend:371
import bend-kit-postgres@0.3.0.0/postgres.bend as Postgres
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-wire@0.4.6.2/wire.bend as Wire
371
372def ssl.byte(s: Socket, +key: String, +host: String, +user: String, +pass: String, +db: String, +ms: U32, r: Bytes.Bytes & Maybe<&2, U32>) -> IO(Result<&1, &1, Failure, Conn>):
373 (b, got) = r
374 match got:
375 case None{}:
376 plain.fail(s, Closed{})
377 case Some{c}:
378 match c:
379 case 83:
380 do IO<Result<&1, &1, Failure, Conn>>:
381 m : Socket & Result<&1, &1, U32 & String, Unit> <- Wire.tls.connect(s, host, ms)
382 tls.done(key, ms, user, pass, db, m)
383 case 78:
384 plain.fail(s, NoTls{})
385 case _:
386 plain.fail(s, Malformed{})