Conversation
|
Could you explain the use case for this? |
| For `ConnectVPN`, the optional `de.blinkt.openvpn.api.serverAddress` extra can temporarily override | ||
| all enabled servers in the profile. Use the format `tcp://host:port` or `udp://host:port`. | ||
| IPv6 addresses must be enclosed in brackets, for example `tcp://[2001:db8::1]:443`. | ||
| The saved profile is not changed. |
There was a problem hiding this comment.
Any reason to not use the syntax OpenVPN already has and the app already has a parser for? E.g. the "remote xyz port proto" syntax. That would also more flexible in other ways like allowing a connection block or something like that.
| } | ||
| } | ||
|
|
||
| static VpnProfile createTemporaryProfile(VpnProfile profile, ServerAddress serverAddress) { |
There was a problem hiding this comment.
Function name is not a great choice here.
| } | ||
|
|
||
| static void overrideServerAddress(VpnProfile profile, ServerAddress serverAddress) { | ||
| profile.mServerName = serverAddress.host; |
There was a problem hiding this comment.
This method needs to be cleaned up. It should just replace the whole list with just one entry instead of modifiying all entries.
| Use `tcp://host:port` or `udp://host:port` to temporarily override all enabled servers | ||
| without changing the saved profile. IPv6 addresses must be enclosed in brackets, for example: | ||
|
|
||
| am start-activity -a android.intent.action.MAIN -e de.blinkt.openvpn.api.profileName mediav6-full -e de.blinkt.openvpn.api.serverAddress tcp://203.0.113.5:8443 de.blinkt.openvpn/.api.ConnectVPN |
|
I have updated the implementation based on your feedback. My use case is connecting to an OpenVPN server through a DDNS hostname. Due to slow DNS updates and occasional DNS hijacking by the ISP, the hostname does not always resolve to the correct current IP address. Since I can reliably obtain the server’s current public IP through an external script, I need this API to pass that IP temporarily to ConnectVPN without modifying the saved profile. Compared with the first revision:
The saved profile remains unchanged. The focused tests pass. |
Summary
de.blinkt.openvpn.api.serverAddressextra to theConnectVPNAPI.tcp://host:portandudp://host:portformats, including bracketed IPv6 addresses.adbexamples.Backward Compatibility
Existing
ConnectVPNcalls continue to work without the new optional extra.