Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
096757c8
Commit
096757c8
authored
Jul 18, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改timeout
parent
af8cfdaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
20 deletions
+35
-20
server.go
pkg/httpd/server.go
+34
-18
websshws.go
pkg/httpd/websshws.go
+1
-2
No files found.
pkg/httpd/server.go
View file @
096757c8
...
...
@@ -4,6 +4,7 @@ import (
"net"
"net/http"
"path/filepath"
"time"
"github.com/gorilla/mux"
"github.com/kataras/neffos"
...
...
@@ -17,26 +18,30 @@ var (
httpServer
*
http
.
Server
)
var
wsEvents
=
neffos
.
Namespaces
{
"ssh"
:
neffos
.
Events
{
neffos
.
OnNamespaceConnected
:
OnNamespaceConnected
,
neffos
.
OnNamespaceDisconnect
:
OnNamespaceDisconnect
,
neffos
.
OnRoomJoined
:
func
(
c
*
neffos
.
NSConn
,
msg
neffos
.
Message
)
error
{
return
nil
var
wsEvents
=
neffos
.
WithTimeout
{
ReadTimeout
:
24
*
time
.
Hour
,
WriteTimeout
:
24
*
time
.
Hour
,
Namespaces
:
neffos
.
Namespaces
{
"ssh"
:
neffos
.
Events
{
neffos
.
OnNamespaceConnected
:
OnNamespaceConnected
,
neffos
.
OnNamespaceDisconnect
:
OnNamespaceDisconnect
,
neffos
.
OnRoomJoined
:
func
(
c
*
neffos
.
NSConn
,
msg
neffos
.
Message
)
error
{
return
nil
},
neffos
.
OnRoomLeft
:
func
(
c
*
neffos
.
NSConn
,
msg
neffos
.
Message
)
error
{
return
nil
},
"data"
:
OnDataHandler
,
"resize"
:
OnResizeHandler
,
"host"
:
OnHostHandler
,
"logout"
:
OnLogoutHandler
,
"token"
:
OnTokenHandler
,
},
neffos
.
OnRoomLeft
:
func
(
c
*
neffos
.
NSConn
,
msg
neffos
.
Message
)
error
{
return
nil
"elfinder"
:
neffos
.
Events
{
neffos
.
OnNamespaceConnected
:
OnELFinderConnect
,
neffos
.
OnNamespaceDisconnect
:
OnELFinderDisconnect
,
},
"data"
:
OnDataHandler
,
"resize"
:
OnResizeHandler
,
"host"
:
OnHostHandler
,
"logout"
:
OnLogoutHandler
,
"token"
:
OnTokenHandler
,
},
"elfinder"
:
neffos
.
Events
{
neffos
.
OnNamespaceConnected
:
OnELFinderConnect
,
neffos
.
OnNamespaceDisconnect
:
OnELFinderDisconnect
,
},
}
...
...
@@ -48,6 +53,17 @@ func StartHTTPServer() {
}
sshWs
.
OnUpgradeError
=
func
(
err
error
)
{
}
sshWs
.
OnConnect
=
func
(
c
*
neffos
.
Conn
)
error
{
if
c
.
WasReconnected
()
{
logger
.
Debugf
(
"Connection reconnected, with tries: %d"
,
c
.
ID
(),
c
.
ReconnectTries
)
}
else
{
logger
.
Debug
(
"A new ws connection arrive"
)
}
return
nil
}
sshWs
.
OnDisconnect
=
func
(
c
*
neffos
.
Conn
)
{
logger
.
Debug
(
"Ws connection disconnect"
)
}
router
:=
mux
.
NewRouter
()
fs
:=
http
.
FileServer
(
http
.
Dir
(
filepath
.
Join
(
conf
.
RootPath
,
"static"
)))
...
...
pkg/httpd/websshws.go
View file @
096757c8
...
...
@@ -24,10 +24,9 @@ import (
func
OnNamespaceConnected
(
c
*
neffos
.
NSConn
,
msg
neffos
.
Message
)
error
{
// 首次连接 1.获取当前用户的信息
cc
:=
c
.
Conn
logger
.
Debug
(
"Web terminal on connect event trigger"
)
if
cc
.
WasReconnected
()
{
logger
.
Debugf
(
"Web terminal reconnected, with tries: %d"
,
cc
.
ID
(),
cc
.
ReconnectTries
)
}
else
{
logger
.
Debug
(
"Web terminal on connect event trigger"
)
}
request
:=
cc
.
Socket
()
.
Request
()
header
:=
request
.
Header
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment