Skip to content

Interface not working #14

@ghost

Description

I try to use interface option but it doesnt work. No error but gives me other interface's ip

var curl = new (require( 'curl-request' ))();

curl
.setOpt('interface', 'eth0')
.setHeaders([
    'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36'
])
.get('www.wtfismyip.com/json')
.then(({statusCode, body, headers}) => {
    console.log(statusCode,body)
})
.catch((e) => {
    console.log(e);
});

It works on command tool with curl. I get the right ip with that command;

sudo curl -s http://www.wtfismyip.com/text --interface eth0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions