package pkg import ( "errors" "strings" ) // WebSocketProfile : Virtual server WebSockets traffic profile configuration type WebSocketProfile struct { ProfileCommon Masking string `json:"masking"` } func ParseWebSocketProfile(raw string) (*WebSocketProfile, error) { p := new(WebSocketProfile) split := strings.Split(raw, "\n") if !strings.Contains(split[0], "ltm profile websocket") { return nil, errors.New("not a websocket profile") } p.ProfileCommon = parseCommon(raw) for _, line := range split { f := strings.Fields(line) switch strings.ToLower(f[0]) { case "masking": p.Masking = strings.Join(f[1:], " ") } } return p, nil }