Numerical treatment of degenerate diffusion equations via Feller's boundary classification, and applications