main: add address validation and unix domain socket support

the port number should not exceed the limit and should not be negative?