Page MenuHomePhabricator

No OneTemporary

diff --git a/app.go b/app.go
index d75c862..8fa20a1 100644
--- a/app.go
+++ b/app.go
@@ -1,93 +1,100 @@
package sshtunnel
import (
"flag"
- "log"
"golang.org/x/crypto/ssh"
- "sync"
- "os/exec"
- "os"
"io"
+ "log"
+ "os"
+ "os/exec"
+ "sync"
)
func (c *Client) Start() {
var wg sync.WaitGroup
//The intermediary server for port binding
serverHostname := flag.String("server", "ubuntu.cse.unr.edu", "a string")
execPath := flag.String("exec", "", "a binary to execute after connecting.")
logFile := flag.String("log", "log.txt", "logfile location")
lf, err := os.OpenFile(*logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening file: %v", err)
}
defer lf.Close()
mw := io.MultiWriter(os.Stdout, lf)
log.SetOutput(mw)
var endpoints EndpointsFlag
flag.Var(&endpoints, "endpoints", "Local and remote endpoints")
flag.Parse()
if len(endpoints) < 1 {
log.Printf("No endpoints defined: %d\n", len(endpoints))
endpoints = make(EndpointsFlag, 0)
endpoints = append(endpoints, "5555:172.28.128.230:5555") // MATLAB
endpoints = append(endpoints, "25734:172.28.128.230:25734") // SolidWorks
endpoints = append(endpoints, "25735:172.28.128.230:25735") // SolidWorks
endpoints = append(endpoints, "7788:134.197.20.21:7788") // MATHCAD
endpoints = append(endpoints, "7789:134.197.20.21:7789") // MATHCAD
endpoints = append(endpoints, "2080:172.28.128.230:2080") // AutoCAD
endpoints = append(endpoints, "27000:172.28.128.230:27000") // AutoCAD
+ endpoints = append(endpoints, "1055:172.28.128.230:1055") //
+ endpoints = append(endpoints, "2325:172.28.128.230:2325") // ANSYS
+ endpoints = append(endpoints, "27004:134.197.20.21:27004") // ABAQUS
+ endpoints = append(endpoints, "4085:134.197.20.21:4085") // ABAQUS
+ endpoints = append(endpoints, "9001:134.197.20.21:9001") // ADS
+ endpoints = append(endpoints, "27005:134.197.20.21:27005") // CST
+ endpoints = append(endpoints, "5001:134.197.20.21:5001") // CST
}
localE, remoteE := ParseEndpointsFromArray(endpoints)
log.Printf("localE: %v remoteE: %v", localE, remoteE)
// 27013
serverEndpoint := &Endpoint{
Host: *serverHostname,
Port: 22,
}
log.Printf("Endpoints: %v serverEndpoint: %v\n", endpoints, serverEndpoint)
var passwordForm = NewPasswordForm()
passwordForm.Show()
credentials := passwordForm.Credentials
log.Printf("Connecting to %s, User: %s ", *serverHostname, credentials.Username)
sshConfig := &ssh.ClientConfig{
User: credentials.Username,
HostKeyCallback: KeyPrint,
Auth: []ssh.AuthMethod{
ssh.Password(credentials.Password),
},
}
tunnel := &SSHtunnel{
Config: sshConfig,
Local: localE,
Server: serverEndpoint,
Remote: remoteE,
}
wg.Add(1)
go func() {
defer wg.Done()
tunnel.Start()
}()
if len(*execPath) > 0 {
cmd := exec.Command(*execPath)
err := cmd.Start()
if err != nil {
log.Fatal(err)
}
}
wg.Wait()
}
diff --git a/windows_ui.go b/windows_ui.go
index 45b50aa..78dbaf4 100644
--- a/windows_ui.go
+++ b/windows_ui.go
@@ -1,66 +1,69 @@
// +build windows,!linux
package sshtunnel
import (
- . "github.com/lxn/walk/declarative"
"github.com/lxn/walk"
+ . "github.com/lxn/walk/declarative"
)
type PasswordForm struct {
Credentials *Credentials
}
func NewPasswordForm() *PasswordForm {
return &PasswordForm{}
}
func (p *PasswordForm) Show() {
var mainWindow *walk.MainWindow
var usernameLE, passwordLE *walk.LineEdit
p.Credentials = &Credentials{Username: "Test"}
MainWindow{
AssignTo: &mainWindow,
- Title: "Login",
+ Title: "UNR College of Engineering Tunneling",
MinSize: Size{250, 150},
+ MaxSize: Size{250, 150},
+ Size: Size{255, 150},
Layout: VBox{},
Children: []Widget{
+ Label{Text: "Connecting to License Servers"},
HSplitter{
Children: []Widget{
Label{Text: "Username"},
LineEdit{AssignTo: &usernameLE},
},
},
HSplitter{
Children: []Widget{
Label{Text: "Password"},
LineEdit{PasswordMode: true,
AssignTo: &passwordLE,
OnKeyDown: func(key walk.Key) {
if key == walk.KeyReturn {
p.Credentials.Username = usernameLE.Text()
p.Credentials.Password = passwordLE.Text()
mainWindow.Close()
}
},
},
},
},
PushButton{
Text: "Login",
OnClicked: func() {
p.Credentials.Username = usernameLE.Text()
p.Credentials.Password = passwordLE.Text()
mainWindow.Close()
},
},
PushButton{
Text: "Cancel",
OnClicked: func() {
mainWindow.Close()
},
},
},
}.Run()
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Apr 5, 5:23 AM (15 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15392
Default Alt Text
(4 KB)

Event Timeline