Skip to content

Commit

Permalink
added string method to ClientMode
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-spb committed Sep 6, 2024
1 parent 2ba6f05 commit 40d3048
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 2 additions & 3 deletions moroz/svc_preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"compress/zlib"
"context"
"encoding/json"
"log"
"net/http"
"time"

Expand Down Expand Up @@ -58,10 +57,10 @@ func decodePreflightRequest(ctx context.Context, r *http.Request) (interface{},
//log.Printf("DEBUG: req body was %#v", zr)
req := preflightRequest{MachineID: id}
if err := json.NewDecoder(zr).Decode(&req.payload); err != nil {
log.Printf("DEBUG: error was %#v", err)
//log.Printf("DEBUG: error was %#v", err)
return nil, err
}
log.Printf("%#v", req)
//log.Printf("%#v", req)
return req, nil
}

Expand Down
13 changes: 13 additions & 0 deletions santa/santa.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package santa

import (
"fmt"

"github.com/pkg/errors"
)

Expand Down Expand Up @@ -214,6 +216,17 @@ const (
Lockdown
)

func (c ClientMode) String() string {
switch c {
case Monitor:
return "MONITOR"
case Lockdown:
return "LOCKDOWN"
default:
return fmt.Sprintf("UNKNOWN_CLIENT_MODE_%d", int(c))
}
}

func (c *ClientMode) UnmarshalText(text []byte) error {
switch mode := string(text); mode {
case "MONITOR":
Expand Down

0 comments on commit 40d3048

Please sign in to comment.