gotunnelserver/server/handleAgent.go

22 lines
427 B
Go
Raw Normal View History

package server
import (
"net/http"
2024-11-13 22:26:29 +08:00
"git.pyer.club/kingecg/gotunnelserver/util"
"github.com/gorilla/websocket"
)
func (s *Server) HandleAgent(c *websocket.Conn, r *http.Request) {
2024-11-13 22:26:29 +08:00
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)
}