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

Static port for captures #16

Open
auras opened this issue Nov 17, 2017 · 16 comments
Open

Static port for captures #16

auras opened this issue Nov 17, 2017 · 16 comments

Comments

@auras
Copy link

auras commented Nov 17, 2017

I want to run hyperfox inside a docker container. But I cannot configure docker to forward a port without knowing it beforehand and for that I would need to be able to configure the port to view the captures.

@elico
Copy link

elico commented Nov 18, 2017

@auras have you tried using bridged interface for the docker machine?
This way you would be able to access the docker directly without any proxy\forwarding.

@auras
Copy link
Author

auras commented Nov 18, 2017 via email

@elico
Copy link

elico commented Nov 18, 2017

@auras So what do you need?
Since it's a docker the inside port will always be the same....
Do you need to register in some place a docker instance external(ie host) port?
Do you need to customize it or publish it?

@auras
Copy link
Author

auras commented Nov 18, 2017 via email

@elico
Copy link

elico commented Nov 18, 2017

@auras The internal would be setup by you and only you as the docker maintainer.
There are couple variables which you can use to do that but I am still not sure what and how.
The settings of hyperfox inside the docker container can be set statically for example 18080.
Then you can play with each instance when you spin it up to set the desired external port.
There shouldn't be ever a situation that you spin a docker and you give it "auto internal port choice".. it's always based on some settings.. so only left the external.

@auras
Copy link
Author

auras commented Nov 19, 2017 via email

@elico
Copy link

elico commented Nov 19, 2017

@auras I have not seen that.
Well the code needs some changing.
There is a flag: defaultPort
But if it's not used then it's either and error or maybe I am not understanding the code right.
@pulkitsharma07 @xiam , Can you clear it out?
Should the flag be used? Is it used?

@pulkitsharma07
Copy link
Contributor

pulkitsharma07 commented Nov 19, 2017

@auras , yes you are right, It will be a random port (https://golang.org/pkg/net/#Listen, If the port in the address parameter is empty or "0", as in "127.0.0.1:" or "[::1]:0", a port number is automatically chosen). There is no functionality (it seems) to have it listen on a specific port. I am not familiar with the code base, So, I guess you'll need to give a PR to have this functionality. If you need it at this moment, you can always change that line (or add a flag) to have it listen to a specific port. Another workaround, is to close all other ports in docker container (So, that we can make that port somewhat deterministic), I am not sure how to achieve this, Just my two cents here.

@elico , That flag is for the port the proxy should bind to. I am not sure what @auras 's use case is. service.go mentioned by @auras is concerned with other services i.e. things other than the actual proxy.

The proxy default port is mentioned here

defaultPort = uint(1080)
you can change it using the p flag.

@auras
Copy link
Author

auras commented Nov 19, 2017 via email

@pulkitsharma07
Copy link
Contributor

Cool, I'll create a PR later.

@auras
Copy link
Author

auras commented Nov 19, 2017 via email

@elico
Copy link

elico commented Nov 19, 2017

@auras What OS are you using?

@auras
Copy link
Author

auras commented Nov 19, 2017

I'm building on a ubuntu 16.04 docker container

@elico
Copy link

elico commented Nov 19, 2017

@auras @pulkitsharma07 I tried to build it for both Linux and FreeBSD but I only managed to build hyperfox for linux 64 bit because of something with sqlite

 github.com/mattn/go-sqlite3
../../go/src/github.com/mattn/go-sqlite3/sqlite3_go18.go:18:10: undefined: SQLiteConn

@auras
Copy link
Author

auras commented Nov 19, 2017 via email

@elico
Copy link

elico commented Nov 19, 2017

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

3 participants