first check for `req.secure` before trying to check tis by headers

#6
Get the remote ip by `req.ip`. Fallback to old version for backwards compatibility

#6
Added ttl to upgrade method + Issues by [thynson](https://github.com/thynson)