Yes, in fact, the super.connect() comes below.
I tried not to flood with sources, but it makes sense for the connect
function.
I thought I made a mistake not using "new
GuacamoleConfiguration(config)", so I adjusted it.
Then I got into some other things I'm not sure of..
This is the current class, I made some prints and put the content behind:
public class ProxmoxConnection extends DelegatingConnection {
...
@Override
public GuacamoleTunnel connect(GuacamoleClientInformation info,
Map<String,String> tokens) throws GuacamoleException {
System.out.println(getConfiguration().getParameters()); // ->
{hostname=192.122.122.122, security=nla, ignore-cert=true, port=3389,
username=user}
System.out.println(getConfiguration().getParameterNames()); //
-> []
GuacamoleConfiguration currentConfig = new
GuacamoleConfiguration(getConfiguration());
System.out.println(currentConfig.getParameters()); // -> {}
currentConfig.setParameter("hostname", "10.20.1.122");
setConfiguration(currentConfig);
System.out.println(getConfiguration().getParameters()); // ->
{hostname=10.20.1.122}
GuacamoleTunnel tunnel = super.connect(info, tokens);
return tunnel;
}
}
If I understood the GuacamoleConfiguration() constructor correctly, it
should copy all the content from the old config by using
getParameterNames(), but I don't get any content while getParameters()
shows me the content of the parameters.
If I send the hostname manually, this is the only parameter. Am I
initializing the configuration wrong?
I also copied all params manually for testing:
currentConfig.setParameter("hostname", "10.20.1.122");
currentConfig.setParameter("security", "nla");
currentConfig.setParameter("ignore-cert", "true");
currentConfig.setParameter("port", "3389");
currentConfig.setParameter("username", "user");
getConnectionID() and getProtocol() already provide the same value.
The connection didn't work anyway with a wrong test IP in the config and
the adjusted one...
If it doesn't work at all I'll think about a DNS or something, but I
thought it might be worth to ask how to do this properly..
Am 28.11.23 um 14:05 schrieb Nick Couchman:
On Mon, Nov 27, 2023 at 6:11 PM Kai <[email protected]> wrote:
Thank you Nick, that brought me many steps forward!
I added some custom attributes and was able to read them out in my
class ProxmoxConnection extends DelegatingConnection using
super.getAttributes().
I got the http connection to the Proxmox API running, I just
didn't combine it all together, yet.
What I was wondering, sometimes the VM ip can get changed or just
isn't static.
I tried to adjust the hostname of the connection inside the
connect() function like this:
GuacamoleConfiguration currentConfig = super.getConfiguration();
currentConfig.setParameter("hostname", "10.20.1.122");
super.setConfiguration(currentConfig);
But it didn't change. Reading the source comments the
configuration might be read already.
Is there a good place to insert a hostname changing ?
I would think that should work, but without seeing more complete code,
I'm not sure why it isn't working. I guess just make sure that you're
not calling the super.connect() prior to this block of code?
-Nick