/* lib/terminal/server/services/agent_online - Determines if a remote agent is online and if so gathers their IP addresses and listening port numbers. */ import getAddress from "../../utilities/getAddress.js";
import ipResolve from "../transmission/ipResolve.js";
import network from "../transmission/network.js";
import vars from "../../utilities/vars.js";
const agent_online = function terminal_server_services_agentOnline(socketData, transmit) {
    const agentData = socketData.data, addresses = getAddress(transmit), local = addresses.local.address, remote = addresses.remote.address;
    vars.agents[agentData.agentType][agentData.agent].ipAll = agentData.ipAll;
    if (remote !== "") {
        vars.agents[agentData.agentType][agentData.agent].ipSelected = remote;
    }
    agentData.ipAll = agentData.agentType === "device" ? vars.network.addresses : ipResolve.userAddresses();
    if (local !== "") {
        agentData.ipSelected = local;
    }
    network.send(socketData, "browser");
    network.send(socketData, "device");
};
export default agent_online;
