update go-liveshare@v0.11.0

This commit is contained in:
Alan Donovan 2021-09-02 15:51:56 -04:00
parent 3485bacc97
commit cee761238b
3 changed files with 6 additions and 8 deletions

View file

@ -70,8 +70,6 @@ func logs(ctx context.Context, tail bool, codespaceName string) error {
return fmt.Errorf("error getting ssh server details: %v", err)
}
tunnel := liveshare.NewPortForwarder(session, "sshd", localSSHPort, remoteSSHServerPort)
cmdType := "cat"
if tail {
cmdType = "tail -f"
@ -86,7 +84,8 @@ func logs(ctx context.Context, tail bool, codespaceName string) error {
tunnelClosed := make(chan error, 1)
go func() {
tunnelClosed <- tunnel.Forward(ctx) // error is non-nil
fwd := liveshare.NewPortForwarder(session, "sshd", remoteSSHServerPort)
tunnelClosed <- fwd.ForwardToLocalPort(ctx, localSSHPort) // error is non-nil
}()
cmdDone := make(chan error, 1)

View file

@ -278,9 +278,9 @@ func forwardPorts(log *output.Logger, codespaceName string, ports []string) erro
for _, pair := range portPairs {
log.Printf("Forwarding ports: remote %d <=> local %d\n", pair.remote, pair.local)
name := fmt.Sprintf("share-%d", pair.remote)
fwd := liveshare.NewPortForwarder(session, name, pair.remote, pair.local)
go func() {
errc <- fwd.Forward(ctx) // error always non-nil
fwd := liveshare.NewPortForwarder(session, name, pair.remote)
errc <- fwd.ForwardToLocalPort(ctx, pair.local) // error always non-nil
}()
}

View file

@ -90,8 +90,6 @@ func ssh(ctx context.Context, sshProfile, codespaceName string, localSSHServerPo
}
}
tunnel := liveshare.NewPortForwarder(session, "sshd", localSSHServerPort, remoteSSHServerPort)
connectDestination := sshProfile
if connectDestination == "" {
connectDestination = fmt.Sprintf("%s@localhost", sshUser)
@ -99,7 +97,8 @@ func ssh(ctx context.Context, sshProfile, codespaceName string, localSSHServerPo
tunnelClosed := make(chan error)
go func() {
tunnelClosed <- tunnel.Forward(ctx) // error is always non-nil
fwd := liveshare.NewPortForwarder(session, "sshd", remoteSSHServerPort)
tunnelClosed <- fwd.ForwardToLocalPort(ctx, localSSHServerPort) // error is always non-nil
}()
shellClosed := make(chan error)