Contour gauges, canonical formalism and flux algebras