getDefaultConfig 获取默认配置
()
| 130 | |
| 131 | // getDefaultConfig 获取默认配置 |
| 132 | func getDefaultConfig() *types.Config { |
| 133 | return &types.Config{ |
| 134 | Network: types.NetworkConfig{ |
| 135 | Timeout: 3 * time.Second, // 减少到3秒 |
| 136 | Retries: 1, |
| 137 | DNSServers: []string{"8.8.8.8", "1.1.1.1"}, |
| 138 | }, |
| 139 | TLS: types.TLSConfig{ |
| 140 | MinVersion: 771, // TLS 1.2 |
| 141 | MaxVersion: 772, // TLS 1.3 |
| 142 | }, |
| 143 | Concurrency: types.ConcurrencyConfig{ |
| 144 | MaxConcurrent: 8, |
| 145 | CheckTimeout: 3 * time.Second, // 减少到3秒 |
| 146 | CacheTTL: 5 * time.Minute, |
| 147 | }, |
| 148 | Output: types.OutputConfig{ |
| 149 | Color: true, |
| 150 | Verbose: false, |
| 151 | Format: "table", |
| 152 | }, |
| 153 | Cache: types.CacheConfig{ |
| 154 | DNSEnabled: true, |
| 155 | ResultEnabled: true, |
| 156 | TTL: 5 * time.Minute, |
| 157 | MaxSize: 1000, |
| 158 | }, |
| 159 | Batch: types.BatchConfig{ |
| 160 | StreamOutput: false, |
| 161 | ProgressBar: true, |
| 162 | ReportFormat: "text", |
| 163 | Timeout: 30 * time.Second, |
| 164 | }, |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | // validateAndSetDefaults 验证配置并设置默认值 |
| 169 | func validateAndSetDefaults(config *types.Config) { |