Source File
streamlocal.go
Belonging Package
golang.org/x/crypto/ssh
package ssh
import (
)
type streamLocalChannelOpenDirectMsg struct {
socketPath string
reserved0 string
reserved1 uint32
}
type forwardedStreamLocalPayload struct {
SocketPath string
Reserved0 string
}
type streamLocalChannelForwardMsg struct {
socketPath string
}
func ( *Client) ( string) (net.Listener, error) {
.handleForwardsOnce.Do(.handleForwards)
:= streamLocalChannelForwardMsg{
,
, , := .SendRequest("streamlocal-forward@openssh.com", true, Marshal(&))
if != nil {
return nil,
}
if ! {
return nil, errors.New("ssh: streamlocal-forward@openssh.com request denied by peer")
}
:= .forwards.add(&net.UnixAddr{Name: , Net: "unix"})
return &unixListener{, , }, nil
}
func ( *Client) ( string) (Channel, error) {
:= streamLocalChannelOpenDirectMsg{
socketPath: ,
}
, , := .OpenChannel("direct-streamlocal@openssh.com", Marshal(&))
if != nil {
return nil,
}
go DiscardRequests()
return ,
}
type unixListener struct {
socketPath string
conn *Client
in <-chan forward
}
.conn.forwards.remove(&net.UnixAddr{Name: .socketPath, Net: "unix"})
:= streamLocalChannelForwardMsg{
.socketPath,
}
, , := .conn.SendRequest("cancel-streamlocal-forward@openssh.com", true, Marshal(&))
if == nil && ! {
= errors.New("ssh: cancel-streamlocal-forward@openssh.com failed")
}
return
}
func ( *unixListener) () net.Addr {
return &net.UnixAddr{
Name: .socketPath,
Net: "unix",
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |