diff --git a/hostname.go b/hostname.go
new file mode 100644
index 0000000..804d9a4
--- /dev/null
+++ b/hostname.go
@@ -0,0 +1,14 @@
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+func main() {
+ localHostName, err := os.Hostname()
+ if err != nil{
+ panic(err)
+ }
+ fmt.Println("Local Host Name:",localHostName)
+}
diff --git a/localMac_addr.go b/localMac_addr.go
new file mode 100644
index 0000000..fec529b
--- /dev/null
+++ b/localMac_addr.go
@@ -0,0 +1,70 @@
+package main
+
+import (
+ "fmt"
+ "net"
+ "strings"
+ "os"
+)
+
+func main() {
+ // localMacAddr, err := net.()
+ // if err != nil{
+ // panic(err)
+ // }
+ // fmt.Println("Local MAC addr:",localMacAddr)
+ //
+ //
+
+ var currentIP, currentNetworkHardwareName string
+
+ currentIP = "134.197.41.183/22"
+
+ interfaces, _ := net.Interfaces()
+ for _, interf := range interfaces {
+ if addrs, err := interf.Addrs(); err == nil {
+ for index, addr := range addrs {
+ if addr.String() != "127.0.0.1/8" {
+ log.Println("[", index, "]", interf.Name, ">", addr)
+
+ // only interested in the name with current IP address
+ if strings.Contains(addr.String(), currentIP) {
+ log.Println("Use name : ", interf.Name)
+ currentNetworkHardwareName = interf.Name
+ }
+ }
+ }
+ }
+ }
+
+ log.Println("-------------------------------------------")
+
+ // extract the hardware information base on the interface name
+ // capture above
+ netInterface, err := net.InterfaceByName(currentNetworkHardwareName)
+
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ name := netInterface.Name
+ macAddress := netInterface.HardwareAddr
+
+ log.Println("Hardware name : ", name)
+ log.Println("MAC address : ", macAddress)
+
+ // verify if the MAC address can be parsed properly
+ hwAddr, err := net.ParseMAC(macAddress.String())
+ if err != nil {
+ log.Println("No able to parse MAC address : ", err)
+ os.Exit(-1)
+ }
+ log.Println("Physical hardware address : %s \n", hwAddr.String())
+
+}
+
+
+
+// net.Interfaces() // returns an array of interfaces
+// net.InterfaceByName(oneOfTheReturnedInterfaces)
+// ^.HardwareAddr
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..2963315
--- /dev/null
+++ b/main.go
@@ -0,0 +1,161 @@
+package main
+
+import (
+ "strings"
+ "os"
+ "fmt"
+ "io"
+ "net"
+ "log"
+ "encoding/base64"
+ "golang.org/x/crypto/ssh"
+ "golang.org/x/crypto/ssh/agent"
+)
+
+type Endpoint struct {
+ Host string
+ Port int
+}
+
+func KeyPrint(dialAddr string, addr net.Addr, key ssh.PublicKey) error {
+ fmt.Printf("%s %s %s\n", strings.Split(dialAddr, ":")[0], key.Type(), base64.StdEncoding.EncodeToString(key.Marshal()))
+ return nil
+}
+
+func (endpoint *Endpoint) String() string {
+ return fmt.Sprintf("%s:%d", endpoint.Host, endpoint.Port)
+}
+
+type SSHtunnel struct {
+ Local *Endpoint
+ Server *Endpoint
+ Remote *Endpoint
+
+ Config *ssh.ClientConfig
+}
+
+func (tunnel *SSHtunnel) Start() error {
+ listener, err := net.Listen("tcp", tunnel.Local.String())
+ if err != nil {
+ return err
+ }
+ defer listener.Close()
+
+ for {
+ conn, err := listener.Accept()
+ if err != nil {
+ return err
+ }
+ go tunnel.forward(conn)
+ }
+}
+
+func (tunnel *SSHtunnel) forward(localConn net.Conn) {
+ serverConn, err := ssh.Dial("tcp", tunnel.Server.String(), tunnel.Config)
+ if err != nil {
+ fmt.Printf("Server dial error: %s\n", err)
+ return
+ }
+
+ remoteConn, err := serverConn.Dial("tcp", tunnel.Remote.String())
+ if err != nil {
+ fmt.Printf("Remote dial error: %s\n", err)
+ return
+ }
+
+ copyConn:=func(writer, reader net.Conn) {
+ _, err:= io.Copy(writer, reader)
+ if err != nil {
+ fmt.Printf("io.Copy error: %s", err)
+ }
+ }
+
+ go copyConn(localConn, remoteConn)
+ go copyConn(remoteConn, localConn)
+}
+
+func SSHAgent() ssh.AuthMethod {
+ if sshAgent, err := net.Dial("unix", os.Getenv("SSH_AUTH_SOCK")); err == nil {
+ return ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers)
+ }
+ return nil
+}
+
+func check(e error) {
+ if e != nil {
+ panic(e)
+ }
+}
+
+func main() {
+
+ fout, err := os.OpenFile("C:\\Projects\\sshtunnel\\sshtunnel_log.log", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666)
+ check(err)
+ log.SetOutput(fout)
+
+ localHostName, err := os.Hostname()
+ check(err)
+
+ localEndpoint := &Endpoint{
+ Host: localHostName,
+ Port: 27013,
+ }
+ log.Println( "Host:", localEndpoint.Host, "Port:" , localEndpoint.Port)
+
+ serverEndpoint := &Endpoint{
+ Host: "ubuntu.cse.unr.edu",
+ Port: 22,
+
+ }
+ log.Println( "Host:", serverEndpoint.Host, "Port:" , serverEndpoint.Port)
+
+ remoteEndpoint := &Endpoint{
+ Host: "motherbrain.unr.edu",
+ Port: 27013,
+ }
+ log.Println( "Host:", remoteEndpoint.Host, "Port:" , remoteEndpoint.Port)
+
+ sshConfig := &ssh.ClientConfig{
+ User: "",
+ HostKeyCallback: KeyPrint,
+ Auth: []ssh.AuthMethod{
+ ssh.Password(""),
+ },
+ }
+
+ tunnel := &SSHtunnel{
+ Config: sshConfig,
+ Local: localEndpoint,
+ Server: serverEndpoint,
+ Remote: remoteEndpoint,
+ }
+
+ var currentNetworkHardwareName string
+
+ interfaces, _ := net.Interfaces()
+ for _, interf := range interfaces {
+ if addrs, err := interf.Addrs(); err == nil {
+ for index, addr := range addrs {
+ log.Println("[", index, "]", interf.Name, ">", addr)
+
+ log.Println("Use name : ", interf.Name)
+ currentNetworkHardwareName = interf.Name
+ }
+ }
+ }
+
+ // extract the hardware information base on the interface name
+ // capture above
+ netInterface, err := net.InterfaceByName(currentNetworkHardwareName)
+ check(err)
+ log.Println(netInterface)
+
+ name := netInterface.Name
+ macAddress := netInterface.HardwareAddr
+
+ log.Println("Hardware name : ", name)
+ log.Println("MAC address : ", macAddress)
+
+ tunnel.Start()
+ fout.Close()
+}
diff --git a/rsrc.syso b/rsrc.syso
new file mode 100644
index 0000000..a90f3de
Binary files /dev/null and b/rsrc.syso differ
diff --git a/sshtunnel_log.log b/sshtunnel_log.log
new file mode 100644
index 0000000..c53beb2
--- /dev/null
+++ b/sshtunnel_log.log
@@ -0,0 +1,20 @@
+2017/04/18 11:08:01 Localhost
+2017/04/18 11:08:01 Host: localhost Port: 27013
+2017/04/18 11:08:01 Host: ubuntu.cse.unr.edu Port: 22
+2017/05/01 15:14:06 Host: ECC-FRONT-01 Port: 27013
+2017/05/01 15:14:06 Host: ubuntu.cse.unr.edu Port: 22
+2017/05/01 15:14:06 Host: motherbrain.unr.edu Port: 27013
+2017/05/01 15:14:06 [ 0 ] Ethernet > fe80::781e:62ac:a47b:1dca/64
+2017/05/01 15:14:06 Use name : Ethernet
+2017/05/01 15:14:06 [ 1 ] Ethernet > 134.197.41.183/22
+2017/05/01 15:14:06 Use name : Ethernet
+2017/05/01 15:14:06 [ 0 ] Loopback Pseudo-Interface 1 > ::1/128
+2017/05/01 15:14:06 Use name : Loopback Pseudo-Interface 1
+2017/05/01 15:14:06 [ 1 ] Loopback Pseudo-Interface 1 > 127.0.0.1/8
+2017/05/01 15:14:06 Use name : Loopback Pseudo-Interface 1
+2017/05/01 15:14:06 [ 0 ] isatap.rd.unr.edu > fe80::200:5efe:86c5:29b7/128
+2017/05/01 15:14:06 Use name : isatap.rd.unr.edu
+2017/05/01 15:14:06 -------------------------------------------
+2017/05/01 15:14:06 &{3 1280 isatap.rd.unr.edu 00:00:00:00:00:00:00:e0 pointtopoint|multicast}
+2017/05/01 15:14:06 Hardware name : isatap.rd.unr.edu
+2017/05/01 15:14:06 MAC address : 00:00:00:00:00:00:00:e0
diff --git a/test.manifest b/test.manifest
new file mode 100644
index 0000000..6667f32
--- /dev/null
+++ b/test.manifest
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/test/test.exe b/test/test.exe
new file mode 100644
index 0000000..b86ea41
Binary files /dev/null and b/test/test.exe differ
diff --git a/test/test.exe.manifest b/test/test.exe.manifest
new file mode 100644
index 0000000..6667f32
--- /dev/null
+++ b/test/test.exe.manifest
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/test/test.go b/test/test.go
new file mode 100644
index 0000000..898dd87
--- /dev/null
+++ b/test/test.go
@@ -0,0 +1,40 @@
+package main
+
+import (
+ "github.com/lxn/walk"
+ . "github.com/lxn/walk/declarative"
+ "strings"
+)
+
+func main() {
+ var inTE, outTE *walk.TextEdit
+
+ MainWindow{
+ Title: "Login",
+ MinSize: Size{350, 200},
+ Layout: VBox{},
+ Children: []Widget{
+ HSplitter{
+ Children: []Widget{
+ //TextEdit{AssignTo: &inTE},
+ //TextEdit{AssignTo: &outTE, ReadOnly: true},
+ //TextEdit{AssignTo: &inTE, ReadOnly: false},
+ //TextEdit{AssignTo: &inTE},
+ Label{ Text: "User"},
+ },
+ },
+ PushButton{
+ Text: "Cancel",
+ OnClicked: func() {
+ outTE.SetText(strings.ToUpper(inTE.Text()))
+ },
+ },
+ PushButton{
+ Text: "Login",
+ OnClicked: func() {
+ outTE.SetText(strings.ToUpper(inTE.Text()))
+ },
+ },
+ },
+ }.Run()
+}