mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 06:05:06 +03:00
Implement simple health checker
on '/h' endpoint. Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
parent
9dc84c6abb
commit
1f76d09a04
2 changed files with 10 additions and 0 deletions
|
@ -53,6 +53,11 @@ func (l *linkWSListener) Close() error {
|
|||
}
|
||||
|
||||
func (s *wsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/h" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("OK"))
|
||||
return
|
||||
}
|
||||
c, err := websocket.Accept(w, r, &websocket.AcceptOptions{
|
||||
Subprotocols: []string{"ygg-ws"},
|
||||
})
|
||||
|
|
|
@ -58,6 +58,11 @@ func (l *linkWSSListener) Close() error {
|
|||
}
|
||||
|
||||
func (s *wssServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/h" {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("OK"))
|
||||
return
|
||||
}
|
||||
c, err := websocket.Accept(w, r, &websocket.AcceptOptions{
|
||||
Subprotocols: []string{"ygg-ws"},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue