22 lines
427 B
Go
22 lines
427 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.pyer.club/kingecg/gotunnelserver/util"
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
func (s *Server) HandleAgent(c *websocket.Conn, r *http.Request) {
|
|
agentSession := NewSession(c)
|
|
agentSession.Start()
|
|
s.agentSession[agentSession.Id] = agentSession
|
|
command := &Command{
|
|
Type: util.NewSession,
|
|
Payload: map[string]string{
|
|
"id": agentSession.Id,
|
|
},
|
|
}
|
|
agentSession.Send(command)
|
|
}
|