[FEATURE] Refactor some abstract functions to lib/gateway.
[FEATURE] Refactor some abstract functions to lib/gateway.

whotooktwarden/gatewayd,zealord/gatewayd,Parkjeahwan/awegeeks,crazyquark/gatewayd,Parkjeahwan/awegeeks,crazyquark/gatewayd,zealord/gatewayd,xdv/gatewayd,xdv/gatewayd,whotooktwarden/gatewayd