Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Commit 4642896

Browse files
committed
added fix for chromeos host
1 parent 1b8bf23 commit 4642896

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
22
bin
33
.vscode
4+
sshcode

main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func main() {
2828
skipSyncFlag = flag.Bool("skipsync", false, "skip syncing local settings and extensions to remote host")
2929
sshFlags = flag.String("ssh-flags", "", "custom SSH flags")
3030
syncBack = flag.Bool("b", false, "sync extensions back on termination")
31+
hostFlag = flag.String("host", "127.0.0.1", "custom host dns")
3132
printVersion = flag.Bool("version", false, "print version information and exit")
3233
)
3334

@@ -53,9 +54,10 @@ func main() {
5354
}
5455

5556
err := sshCode(host, dir, options{
56-
skipSync: *skipSyncFlag,
57-
sshFlags: *sshFlags,
58-
syncBack: *syncBack,
57+
skipSync: *skipSyncFlag,
58+
sshFlags: *sshFlags,
59+
localHost: *hostFlag,
60+
syncBack: *syncBack,
5961
})
6062

6163
if err != nil {

sshcode.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type options struct {
2525
skipSync bool
2626
syncBack bool
2727
localPort string
28+
localHost string
2829
remotePort string
2930
sshFlags string
3031
}
@@ -99,8 +100,8 @@ func sshCode(host, dir string, o options) error {
99100
if err != nil {
100101
return xerrors.Errorf("failed to start code-server: %w", err)
101102
}
102-
103-
url := "http://127.0.0.1:" + o.localPort
103+
flog.Info("Using local host value: " + o.localHost)
104+
url := "http://" + o.localHost + ":" + o.localPort
104105
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
105106
defer cancel()
106107

0 commit comments

Comments
 (0)