  In this work, we study the possibility of generalizing solutions of regular
black holes with an electric charge, constructed in general relativity, for the
$f(G)$ theory, where $G$ is the Gauss-Bonnet invariant. This type of solution
arises due to the coupling between gravitational theory and nonlinear
electrodynamics. We construct the formalism in terms of a mass function and it
results in different gravitational and electromagnetic theories for which mass
function. The electric field of these solutions are always regular and the
strong energy condition is violated in some region inside the event horizon.
For some solutions, we get an analytical form for the $f(G)$ function. Imposing
the limit of some constant going to zero in the $f(G)$ function we recovered
the linear case, making the general relativity a particular case.
