@@ -118,43 +118,6 @@ func FetchCheckpoint(ctx context.Context, client *http.Client, baseURL string) (
118118 }, nil
119119}
120120
121- // FetchTile fetches a tile from the tiled CT log using the provided client.
122- // If partialWidth > 0, fetches a partial tile with that width (1-255).
123- func FetchTile (ctx context.Context , client * http.Client , baseURL string , tileIndex , partialWidth uint64 ) ([]TileLeaf , error ) {
124- baseURL = strings .TrimRight (baseURL , "/" )
125- tilePath := encodeTilePath (tileIndex )
126-
127- if partialWidth > 0 {
128- tilePath = fmt .Sprintf ("%s.p/%d" , tilePath , partialWidth )
129- }
130-
131- url := fmt .Sprintf ("%s/tile/data/%s" , baseURL , tilePath )
132-
133- req , newReqErr := http .NewRequestWithContext (ctx , http .MethodGet , url , nil )
134- if newReqErr != nil {
135- return nil , fmt .Errorf ("failed to create tile request: %w" , newReqErr )
136- }
137-
138- req .Header .Set ("User-Agent" , UserAgent )
139-
140- resp , reqErr := client .Do (req )
141- if reqErr != nil {
142- return nil , fmt .Errorf ("fetching tile %d: %w" , tileIndex , reqErr )
143- }
144- defer resp .Body .Close ()
145-
146- if resp .StatusCode != http .StatusOK {
147- return nil , fmt .Errorf ("%w: unexpected status code %d" , ErrRequestFailed , resp .StatusCode )
148- }
149-
150- data , err := io .ReadAll (resp .Body )
151- if err != nil {
152- return nil , fmt .Errorf ("reading tile data: %w" , err )
153- }
154-
155- return ParseTileData (data )
156- }
157-
158121// ParseTileData parses the binary tile data into TileLeaf entries using cryptobyte.
159122func ParseTileData (data []byte ) ([]TileLeaf , error ) {
160123 var leaves []TileLeaf
@@ -316,7 +279,7 @@ func (s *StaticCTClient) Monitor(ctx context.Context, foundCert func(*ct.RawLogE
316279// It returns true if at least one full tile was fetched.
317280func (s * StaticCTClient ) fetchAndProcessTiles (ctx context.Context , foundCert func (* ct.RawLogEntry ), foundPrecert func (* ct.RawLogEntry )) (bool , error ) {
318281 // Fetch current checkpoint
319- checkpoint , fetchErr := s .fetchCheckpoint (ctx )
282+ checkpoint , fetchErr := s .FetchCheckpoint (ctx )
320283 if fetchErr != nil {
321284 return false , fmt .Errorf ("fetching checkpoint: %w" , fetchErr )
322285 }
@@ -425,8 +388,8 @@ func (s *StaticCTClient) fetchTile(ctx context.Context, tileIndex, partialWidth
425388 return ParseTileData (data )
426389}
427390
428- // fetchCheckpoint fetches the checkpoint from a tiled CT log using the provided client.
429- func (s * StaticCTClient ) fetchCheckpoint (ctx context.Context ) (* TiledCheckpoint , error ) {
391+ // FetchCheckpoint fetches the checkpoint from a tiled CT log using the provided client.
392+ func (s * StaticCTClient ) FetchCheckpoint (ctx context.Context ) (* TiledCheckpoint , error ) {
430393 url := s .url + "/checkpoint"
431394
432395 req , newReqErr := http .NewRequestWithContext (ctx , http .MethodGet , url , nil )
0 commit comments