using System; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using System.Text.Json.Serialization; namespace FastGithub.Scanner { sealed class Meta { [JsonPropertyName("hooks")] public string[] Hooks { get; set; } = Array.Empty(); [JsonPropertyName("web")] public string[] Web { get; set; } = Array.Empty(); [JsonPropertyName("api")] public string[] Api { get; set; } = Array.Empty(); [JsonPropertyName("git")] public string[] Git { get; set; } = Array.Empty(); [JsonPropertyName("packages")] public string[] Packages { get; set; } = Array.Empty(); [JsonPropertyName("pages")] public string[] Pages { get; set; } = Array.Empty(); [JsonPropertyName("importer")] public string[] Importer { get; set; } = Array.Empty(); [JsonPropertyName("actions")] public string[] Actions { get; set; } = Array.Empty(); [JsonPropertyName("dependabot")] public string[] Dependabot { get; set; } = Array.Empty(); public IEnumerable ToGithubContexts() { foreach (var range in IPRange.From(this.Web).OrderBy(item => item.Size)) { if (range.AddressFamily == AddressFamily.InterNetwork) { foreach (var address in range) { yield return new GithubContext("github.com", address); } } } } } }