Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "host", Short: "host command behind the cloudflare proxy", Aliases: []string{"h"}, Args: cobra.ExactArgs(1), Run: func(c *cobra.Command, args []string) { host := args[0] api, err := cloudflare.NewWithAPIToken(os.Getenv("CLOUDFLARE_API_TOKEN")) if err != nil { log.Fatal(err) } ctx := context.Background() zoneID, err := api.ZoneIDByName(host) if err != nil { log.Fatal(err) } records, _, err := api.ListDNSRecords( ctx, cloudflare.ZoneIdentifier(zoneID), cloudflare.ListDNSRecordsParams{}, ) if err != nil { log.Fatal(err) } table := tablewriter.NewWriter(os.Stdout) table.SetBorder(false) table.SetHeader([]string{ "Name", "Type", "Value", }) for _, record := range records { if FlagAll || record.Name == host { table.Append([]string{br(record.Name, 30), record.Type, br(record.Content, 60)}) } } table.Render() }, }
View Source
var FlagAll bool
View Source
var FlagNoBr bool
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.