Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface not working #14

Open
ozican opened this issue Jul 6, 2020 · 0 comments
Open

Interface not working #14

ozican opened this issue Jul 6, 2020 · 0 comments

Comments

@ozican
Copy link

ozican commented Jul 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant