My confusion regarding Hydrogen peroxide
Each oxygen atom is connected to a hydrogen atom(which develops -1 charge on oxygen and +1 on hydrogen) and to another $\textbf{oxygen}$ atom which contributes no charge to both(0 and 0). Similar for other oxygen atom. Hence oxygen state of each oxygen atom is -1 and for each hydrogen atom it is +1.

In general, in peroxide linkage, oxygen has -1 oxidation state