Non-equilibrium thermodynamics of boundary conditions for rarefied gases and related phenomena