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

discovery service: dynamically replace 0.0.0.0 endpointUrl in server response #687

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brubbel
Copy link
Contributor

@brubbel brubbel commented Aug 30, 2018

cfr. #680

If the opcua server is configured with the default endpoint 'opc.tcp://0.0.0.0:4840',
the discovery service will dynamically replace the endpointUrl with the url provided in the FindServersParameters request of the client. e.g. 'opc.tcp://192.168.10.123:4840'
If the opcua server is configured with a valid endpoint url, configuration remains untouched.

Solves the following issues:

  1. Fixes the "Replaced Hostname" warning in UaExpert, even when the opcua server is listening on multiple interfaces.
    image
  2. Makes freeopcua compatible with OPC Scout (and possibly also with WinCC) if a certificate is used.
  3. Provides a simple solution for a valid endpointUrl for NAT'ed systems (vpn etc), without a global discovery server.

@brubbel
Copy link
Contributor Author

brubbel commented Sep 2, 2018

Will need second pair of eyes for this :-)
import ipaddress only works for Py3. Is it acceptable to add a dependency to py2-ipaddress (pip install ipaddress) for Py2?

return edps
return self.endpoints[:]
# return to client the endpoints it has access to
edps = pickle.loads(pickle.dumps(self.endpoints))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is that? why dumping then loading again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shallow copy() does not copy the endpoints, so either deepcopy() or pickle...

@oroulet
Copy link
Member

oroulet commented Sep 2, 2018

The first version was simple, but the last commit really complicate things... I am afraid to add so much code jsut to replace 0.0.0.0 for clients when this can simply be done by configuring the server

@brubbel
Copy link
Contributor Author

brubbel commented Sep 2, 2018

Ok, but the problem is still there when listening on multiple interfaces, or when the server is using dhcp, or the client is using VPN. Maybe it's better to let the PR pending for a while until it's all worked out nicely?
(Things became complicated when involving IPv6).

Goal is ultimately to support opc.tcp://nicehostname:4840/freeopcua/server without any additional IP stuff.

@oroulet
Copy link
Member

oroulet commented Sep 3, 2018

yes using deepcopy is clearly the correct way to implement this ;-)

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

Successfully merging this pull request may close these issues.

3 participants