OnRconConnection
OxideServerobject OnRconConnection(System.Net.IPAddress Address)Works — the game method in this build is the one the hook was written for.
Parameters
- Address
- System.Net.IPAddress
Return value
objectReturn a value of the method's result type and the game returns it immediately; null continues as usual.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnRconConnection(System.Net.IPAddress Address)
{
Puts("OnRconConnection");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return null; // null — the game continues as usual
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point 1
Rust.opj (Oxide)
void Facepunch.RCon.RConListener.ProcessConnections()
Passes: System.Net.IPAddress Address
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (l1.Address)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
if (!server.Pending())
{
return;
}
Socket socket = server.AcceptSocket();
if (socket != null)
{
IPEndPoint iPEndPoint = socket.RemoteEndPoint as IPEndPoint;
if (Interface.CallHook("OnRconConnection", iPEndPoint.Address) != null)
{
return;
}
if (IsBanned(iPEndPoint.Address))
{
Debug.Log("[RCON] Ignoring connection - banned. " + iPEndPoint.Address.ToString());
socket.Close();
}
// …Injection point 2
Rust.opj (Oxide)
void Facepunch.Rcon.Listener.OnConnection(Fleck.IWebSocketConnection)
Passes: System.Net.IPAddress ClientIpAddress
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (a0.ConnectionInfo.ClientIpAddress)Facepunch.Rcon.dll
Where it is called (this branch's game code)
// …
}
if (socket.ConnectionInfo.Path == text && LogFailedAttempts)
{
Debug.Log($"RCON: CRITICAL - Banned IP {address} supplied the correct password. Access was still denied.");
}
socket.Close();
return;
}
if (Interface.CallHook("OnRconConnection", socket.ConnectionInfo.ClientIpAddress) != null)
{
return;
}
if (socket.ConnectionInfo.Path != text)
{
if (LogFailedAttempts)
{
Debug.Log($"RCON: IP {address} attempted to connect with incorrect password.");
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.