Skip to content

NewSocks5Proxy hostKey type is private want to use custom ssh HostKeyCallback #21

Description

@xor-gate

Hi all,

I was playing around with this nice package. But needed to dig deep to come to the conclusion the hostType private interface is a single function private interface where the public caller needs to implement

https://github.com/cloudfoundry/socks5-proxy/blob/main/socks5_proxy.go#L22

When I want to extend my CLI tool with SSHFP (ssh DNS host fingerprint) functionality it is not clear. When using this package it is not 100% clear what needs to be passed to the NewSocks5Proxy hostKey parameter. I hacked my CLI tool with a custom Get function and cache the fetched host key. Which is almost the same implementation as the public HostKey type.

UPDATE: It is simpler than I thought with the following code to use the standard mechanism. But this doesn't allow custom host key handling.

hostKey := proxy.NewHostKey()
sshSocks5Proxy := proxy.NewSocks5Proxy(&hostKey, nil, time.Minute)

The package I want to integrate is https://github.com/xor-gate/sshfp so the host key can be trusted using a SSHFP DNS record.

Hopefully this is clear enough, or else please ask.

Long story short: Why is the interface of hostKey type private?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Pending Review | Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions