Skip to content

crypto/tls: export some constants and helpers such as Unmarshaling methods for headers #23679

Closed
@cblomart

Description

@cblomart

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.1 windows/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

windows amd64

What did you do?

I am looking for tls server name indication routing and found.
There are different github repositories about that.
They all need to parse tls hello message to get the SNI.

I do think that using "crypto/tls" is the best.
Just to have a single reference on what is tls for golang.

In the end such projects need to implement their own code to decode hello message because most of "crypto/tls" constants and unmarshaling methods are not exported.

What did you expect to see?

Basic constants exported for common tls.
Unmarshaling methods exported for tls "headers"

What did you see instead?

All these informations are not exported by "crypto/tls"

Activity

changed the title [-]Open crypto/tls a bit.[/-] [+]crypto/tls: export some constants and helpers such as Unmarshaling methods for headers[/+] on Feb 3, 2018
odeke-em

odeke-em commented on Feb 3, 2018

@odeke-em
Member

Hello @cblomart, thank you for the experience report/bug!

Let me page some crypto folks @agl @FiloSottile @davecheney

bradfitz

bradfitz commented on Feb 3, 2018

@bradfitz
Contributor

Sorry, we don't want to export more stuff from the crypto/tls package. Any extra API is extra godoc and is extra user confusion when trying to read the docs.

If you just want to parse SNI using crypto/tls, see what I did at https://github.com/google/tcpproxy/blob/de1c7de/sni.go#L156

You could copy that, or move it to a common package on github somewhere.

cblomart

cblomart commented on Feb 3, 2018

@cblomart
Author

Thx for the tip!

I little tricky nevertheless, but does the job without too much repetition.

locked and limited conversation to collaborators on Feb 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bradfitz@cblomart@odeke-em@gopherbot

        Issue actions

          crypto/tls: export some constants and helpers such as Unmarshaling methods for headers · Issue #23679 · golang/go