Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Opportunistic TLS #1

Description

@kgaughan

This comment on lobste.rs gives a clever way of adding opportunistic TLS support to a Gopher daemon. Here's the outline in C:

recv(socket, buf, sizeof(buf), MSG_PEEK));  /* add error handling though */

if (buf[0] == 0x12 || buf[0] == 0x16) {
    tls_init(socket); /* normal TLS functions still work there */
    gopher_read = tls_read;
} else {
    gopher_read = read;
}

/* no special case for TLS or SSL to add */
handle_gopher(socket, gopher_read);

This ought to be possible with buffered IO in Go.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions