Put the duck legs into a large container (a large, heavy-duty ziplock bag works well) and add the salt, pickling spices, garlic, onion, and thyme. Mix together thoroughly, making sure each leg is coated with the salt. Cover with plastic wrap (if not using a bag) and refrigerate for at least 18 hours and up to 2 days.
In a very large Dutch oven or other large heavy-based pot, melt most of the fat slowly over low heat. Remove the duck legs from the refrigerator. Reserve the garlic from the marinade. Rinse each duck leg well under cold running water to rinse the salt off, and pat dry well, using paper towels.
Heat the oven to 200 degrees Fahrenheit.
Slip the legs and the garlic into the pot of warm fat. The fat should cover the duck completely. If it does not, add more fat. Cook the legs over medium heat until the temperature of the fat reaches 190 degrees Fahrenheit on a candy/ frying thermometer, then cover the pot and carefully move it into the oven. Bake at 200 degrees until the legs are fork-tender, about 3 hours.
Remove the pot from the oven and allow the duck legs to cool in the fat for about half an hour. Have ready one or more clean containers to hold the duck legs and the fat. Use a slotted spoon to transfer the legs into the containers. Remove the garlic from the pot, but do not add it to the duck legs - set it aside (see note at end of recipe).
Allow the duck fat to cool, but do not let it solidify. Using a fine-mesh strainer, strain the fat over the duck legs, leaving behind any debris or juices from the duck legs, which will have sunk to the bottom of the pot. Make sure that the legs are completely covered, and tap the containers lightly on the counter to help remove any air bubbles. Reserve any remaining clear strained duck fat and store in the refrigerator.
Refrigerate the confit until the fat hardens fully. When the fat is hard, add another 1/2 inch layer of melted fat (which you saved from earlier, in the fridge. If you did not have enough to save, you could use fresh pork lard or peanut oil) to ensure that the legs are completely sealed in fat. Refrigerate the confit to allow the legs to mellow and develop flavor for at least a few days and up to 1 month before using.
To use the confit, let the fat in the container soften at room temperature. Or set the container in a pan of warm water. Take out as many pieces as you plan to use. Cover the remaining pieces with more fat or peanut oil (the confit becomes more perishable once the seal is broken, so use the rest within a week or so). Scrape away the fat clinging to the confit and use as you like or as directed in a recipe. If you are using the confit on its own in a salad, heat it under a broiler until the skin is crispy.
Note on garlic: press the garlic through a mesh strainer. You now have an excellent garlic purée to add to sauces, stews, or to spread on bread.