package pkg import ( "errors" "strings" ) type PPTPProfile struct { ProfileCommon IncludeDestinationIP string `json:"include_destination_ip"` PublisherName string `json:"publisher_name"` } func ParsePPTP(raw string) (*PPTPProfile, error) { p := new(PPTPProfile) split := strings.Split(raw, "\n") if !strings.Contains(split[0], "ltm profile pptp") { return nil, errors.New("not a pptp profile") } p.ProfileCommon = parseCommon(raw) for _, line := range split { f := strings.Fields(line) switch strings.ToLower(f[0]) { case "include-destination-ip": p.IncludeDestinationIP = f[1] case "publisher-name": p.PublisherName = strings.Join(f[1:], " ") } } return p, nil }