FetchServerList fetches the server list from api.hide.me. It has to use system-wide CA store, has to relax PIN checks, use api.hide.me SAN and may use HTTP2
( ctx context.Context )
| 315 | |
| 316 | // FetchServerList fetches the server list from api.hide.me. It has to use system-wide CA store, has to relax PIN checks, use api.hide.me SAN and may use HTTP2 |
| 317 | func ( c *Client ) FetchServerList( ctx context.Context ) ( response []byte, headers http.Header, err error ) { |
| 318 | c.Config.Port = 443 |
| 319 | c.Config.CA = "" |
| 320 | c.Config.Host = "api.hide.me" |
| 321 | |
| 322 | if err = c.Init(); err != nil { log.Println( "SeLi: [ERR] REST Client setup failed:", err ); return } |
| 323 | c.authorizedPins = nil |
| 324 | c.client.Transport.(*http.Transport).TLSClientConfig.ServerName = "api.hide.me" |
| 325 | |
| 326 | if err = c.Resolve( ctx ); err != nil { log.Println( "SeLi: [ERR] DNS failed:", err ); return } |
| 327 | |
| 328 | c.client.Transport.(*http.Transport).Protocols.SetHTTP1( true ) |
| 329 | c.client.Transport.(*http.Transport).Protocols.SetHTTP2( true ) |
| 330 | return c.get( ctx, "https://" + c.remote.String() + "/v1/network/free/en" ) |
| 331 | } |
| 332 | |
| 333 | func ( c *Client ) PrintServerList( ctx context.Context, kind string ) ( err error ) { |
| 334 | response, _, err := c.FetchServerList(ctx) |
no test coverage detected