FAQ
The docs for tls.Conn say:

// A Conn represents a secured connection. 23 // It implements the net.Conn interface.

However, when I try to do a type assertion, it's returned as impossible:

impossible type assertion:
tls.Conn does not implement net.Conn (Close method has pointer receiver)

See example here:

http://play.golang.org/p/4Yx_xDpZxq


Why do this? I'm trying to get at the tls.Conn.ConnectionState() stuff in
the case that my net.Conn is actually a tls.Conn.

Any help appreciated!

Thanks,
Steve

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • William Cybriwsky at Oct 13, 2014 at 10:31 pm
    You're seeing that because it's *tls.Conn, not tls.Conn, that implements
    net.Conn. See http://play.golang.org/p/lc7dXbVqXk for a 'revised' example.

    The wording of 'It implements the net.Conn interface' might be a little
    imprecise, but similar language is used in, at least, the UnixConn doc
    ("UnixConn is an implementation of the Conn interface for connections to
    Unix domain sockets.").
    On Monday, October 13, 2014 6:02:21 PM UTC-4, Stephen Waits wrote:

    The docs for tls.Conn say:

    // A Conn represents a secured connection. 23 // It implements the net.Conn interface.

    However, when I try to do a type assertion, it's returned as impossible:

    impossible type assertion:
    tls.Conn does not implement net.Conn (Close method has pointer receiver)

    See example here:

    http://play.golang.org/p/4Yx_xDpZxq


    Why do this? I'm trying to get at the tls.Conn.ConnectionState() stuff in
    the case that my net.Conn is actually a tls.Conn.

    Any help appreciated!

    Thanks,
    Steve
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Stephen Waits at Oct 13, 2014 at 10:48 pm
    Seems so obvious.. now. ;) Thanks!
    On Monday, October 13, 2014 3:31:44 PM UTC-7, william....@gmail.com wrote:

    You're seeing that because it's *tls.Conn, not tls.Conn, that implements
    net.Conn. See http://play.golang.org/p/lc7dXbVqXk for a 'revised' example.

    The wording of 'It implements the net.Conn interface' might be a little
    imprecise, but similar language is used in, at least, the UnixConn doc
    ("UnixConn is an implementation of the Conn interface for connections to
    Unix domain sockets.").
    On Monday, October 13, 2014 6:02:21 PM UTC-4, Stephen Waits wrote:

    The docs for tls.Conn say:

    // A Conn represents a secured connection. 23 // It implements the net.Conn interface.

    However, when I try to do a type assertion, it's returned as impossible:

    impossible type assertion:
    tls.Conn does not implement net.Conn (Close method has pointer receiver)

    See example here:

    http://play.golang.org/p/4Yx_xDpZxq


    Why do this? I'm trying to get at the tls.Conn.ConnectionState() stuff in
    the case that my net.Conn is actually a tls.Conn.

    Any help appreciated!

    Thanks,
    Steve
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 13, '14 at 10:02p
activeOct 13, '14 at 10:48p
posts3
users2
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase