Commit 9302bd7f by anun

api get list client

parent 777d595a
...@@ -5,7 +5,8 @@ ADD . /src ...@@ -5,7 +5,8 @@ ADD . /src
WORKDIR /src WORKDIR /src
ENV CGO_ENABLED 0 ENV CGO_ENABLED 0
RUN go build \ 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 -o /tmp/bin
# run stage # run stage
FROM scratch FROM scratch
...@@ -13,4 +14,4 @@ LABEL maintainer="dev@jpillora.com" ...@@ -13,4 +14,4 @@ LABEL maintainer="dev@jpillora.com"
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app WORKDIR /app
COPY --from=build /tmp/bin /app/bin COPY --from=build /tmp/bin /app/bin
ENTRYPOINT ["/app/bin"] ENTRYPOINT ["/app/bin"]
\ No newline at end of file
No preview for this file type
...@@ -77,7 +77,8 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) { ...@@ -77,7 +77,8 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) {
case "/version": case "/version":
w.Write([]byte(chshare.BuildVersion)) w.Write([]byte(chshare.BuildVersion))
return return
case "/register": /*
case "/regport":
ltn, err := getTCPPort() ltn, err := getTCPPort()
if err != nil { if err != nil {
w.WriteHeader(500) w.WriteHeader(500)
...@@ -85,6 +86,14 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) { ...@@ -85,6 +86,14 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) {
} }
w.Write([]byte(strconv.Itoa(ltn))) w.Write([]byte(strconv.Itoa(ltn)))
return 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 //missing :O
w.WriteHeader(404) w.WriteHeader(404)
...@@ -235,10 +244,10 @@ func (s *Server) handleWebsocket(w http.ResponseWriter, req *http.Request) { ...@@ -235,10 +244,10 @@ func (s *Server) handleWebsocket(w http.ResponseWriter, req *http.Request) {
l.Debugf("Closed connection (%s)", err) l.Debugf("Closed connection (%s)", err)
} else { } else {
l.Debugf("Closed connection") l.Debugf("Closed connection")
} if len(edge) != 0 {
if len(edge) != 0 { l.Debugf("Disable tunnel port %d", edge[0].Tunnelbrokerport)
l.Debugf("Disable tunnel port %d", edge[0].Tunnelbrokerport) updateConnectionEdge(s.db, edge[0].Edgeid, edge[0].Edgesecret, edge[0].Tunnelbrokerport, false)
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