@@ -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
@@ -330,7 +293,7 @@ func (s *StaticCTClient) Monitor(ctx context.Context, foundCert func(*ct.RawLogE
330293// It returns true if at least one full tile was fetched.
331294func (s * StaticCTClient ) fetchAndProcessTiles (ctx context.Context , foundCert func (* ct.RawLogEntry ), foundPrecert func (* ct.RawLogEntry )) (bool , error ) {
332295 // Fetch current checkpoint
333- checkpoint , fetchErr := s .fetchCheckpoint (ctx )
296+ checkpoint , fetchErr := s .FetchCheckpoint (ctx )
334297 if fetchErr != nil {
335298 return false , fmt .Errorf ("fetching checkpoint: %w" , fetchErr )
336299 }
@@ -471,8 +434,8 @@ func (s *StaticCTClient) fetchTile(ctx context.Context, tileIndex, partialWidth
471434 return ParseTileData (data )
472435}
473436
474- // fetchCheckpoint fetches the checkpoint from a tiled CT log using the provided client.
475- func (s * StaticCTClient ) fetchCheckpoint (ctx context.Context ) (* TiledCheckpoint , error ) {
437+ // FetchCheckpoint fetches the checkpoint from a tiled CT log using the provided client.
438+ func (s * StaticCTClient ) FetchCheckpoint (ctx context.Context ) (* TiledCheckpoint , error ) {
476439 url := s .url + "/checkpoint"
477440
478441 req , newReqErr := http .NewRequestWithContext (ctx , http .MethodGet , url , nil )
0 commit comments