Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F136347
app.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
app.go
View Options
package
sshhop
import
(
"flag"
"log"
"golang.org/x/crypto/ssh"
"io/ioutil"
)
func
(
c
*
Client
)
Start
(){
//The intermediary server for port binding
serverHostname
:=
flag
.
String
(
"server"
,
"alpine.cse.unr.edu"
,
"Intermediate Server"
)
username
:=
flag
.
String
(
"username"
,
"user"
,
"Username"
)
privKey
:=
flag
.
String
(
"privkey"
,
"/nfs/home/user/.ssh/id_rsa"
,
"Private Key"
)
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
,
"www.cse.unr.edu:22"
)
endpoints
=
append
(
endpoints
,
"www.cse.unr.edu:22"
)
endpoints
=
append
(
endpoints
,
"www.cse.unr.edu:22"
)
}
// 27013
serverEndpoint
:=
&
Endpoint
{
Host
:
*
serverHostname
,
Port
:
22
,
}
key
,
err
:=
ioutil
.
ReadFile
(
*
privKey
)
if
err
!=
nil
{
log
.
Fatalf
(
"Unable to read private key: %v"
,
err
)
}
// Create the Signer for this private key.
signer
,
err
:=
ssh
.
ParsePrivateKey
(
key
)
if
err
!=
nil
{
log
.
Fatalf
(
"unable to parse private key: %v"
,
err
)
}
sshConfig
:=
&
ssh
.
ClientConfig
{
User
:
*
username
,
HostKeyCallback
:
KeyPrint
,
Auth
:
[]
ssh
.
AuthMethod
{
ssh
.
PublicKeys
(
signer
),
},
}
tunnel
:=
&
SSHtunnel
{
Config
:
sshConfig
,
Server
:
serverEndpoint
,
Remote
:
endpoints
,
}
tunnel
.
Start
()
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 25, 2:39 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15214
Default Alt Text
app.go (1 KB)
Attached To
rSH sshhop
Event Timeline
Log In to Comment