MCPcopy
hub / github.com/syncthing/syncthing / check

Method check

lib/discover/global.go:387–402  ·  view source on GitHub ↗
(resp *http.Response)

Source from the content-addressed store, hash-verified

385}
386
387func (c *idCheckingHTTPClient) check(resp *http.Response) error {
388 if resp.TLS == nil {
389 return errors.New("security: not TLS")
390 }
391
392 if len(resp.TLS.PeerCertificates) == 0 {
393 return errors.New("security: no certificates")
394 }
395
396 id := protocol.NewDeviceID(resp.TLS.PeerCertificates[0].Raw)
397 if !id.Equals(c.id) {
398 return errors.New("security: incorrect device id")
399 }
400
401 return nil
402}
403
404func (c *idCheckingHTTPClient) Get(ctx context.Context, url string) (*http.Response, error) {
405 resp, err := c.httpClient.Get(ctx, url)

Callers 2

GetMethod · 0.95
PostMethod · 0.95

Calls 3

EqualsMethod · 0.95
NewDeviceIDFunction · 0.92
NewMethod · 0.65

Tested by

no test coverage detected