Commit 9302bd7f by anun

api get list client

parent 777d595a
......@@ -5,7 +5,8 @@ ADD . /src
WORKDIR /src
ENV CGO_ENABLED 0
RUN go build \
-ldflags "-X dev.nexpie.com/anun/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
# -ldflags "-X dev.nexpie.com/anun/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
-ldflags "-X dev.nexpie.com/anun/chisel/share.BuildVersion=main" \
-o /tmp/bin
# run stage
FROM scratch
......
No preview for this file type
......@@ -77,7 +77,8 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) {
case "/version":
w.Write([]byte(chshare.BuildVersion))
return
case "/register":
/*
case "/regport":
ltn, err := getTCPPort()
if err != nil {
w.WriteHeader(500)
......@@ -85,6 +86,14 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) {
}
w.Write([]byte(strconv.Itoa(ltn)))
return
*/
case "/client":
s.Debugf("---> session : %s", s.sessions)
s.Debugf("---> user : %s", s.users.Len())
w.Write([]byte("Client list:\n"))
w.Write([]byte(strconv.Itoa(s.users.Len())))
return
}
//missing :O
w.WriteHeader(404)
......@@ -235,11 +244,11 @@ func (s *Server) handleWebsocket(w http.ResponseWriter, req *http.Request) {
l.Debugf("Closed connection (%s)", err)
} else {
l.Debugf("Closed connection")
}
if len(edge) != 0 {
l.Debugf("Disable tunnel port %d", edge[0].Tunnelbrokerport)
updateConnectionEdge(s.db, edge[0].Edgeid, edge[0].Edgesecret, edge[0].Tunnelbrokerport, false)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment