public override bool Equals(object obj) { if (obj == null) { return(false); } ToxNode node = obj as ToxNode; if ((object)node == null) { return(false); } return(this == node); }
/// <summary> /// Bootstraps the tox client with a ToxNode. /// </summary> /// <param name="node"></param> /// <returns></returns> public bool BootstrapFromNode(ToxNode node) { if (disposed) throw new ObjectDisposedException(GetType().FullName); return ToxFunctions.BootstrapFromAddress(tox, node.Address, (ushort)node.Port, node.PublicKey.GetBytes()) == 1; }
/// <summary> /// Similar to BootstrapFromNode, except this is for tcp relays only. /// </summary> /// <param name="node"></param> /// <returns></returns> public bool AddTcpRelay(ToxNode node) { if (disposed) throw new ObjectDisposedException(GetType().FullName); return ToxFunctions.AddTcpRelay(tox, node.Address, (ushort)node.Port, node.PublicKey.GetBytes()) == 1; }
/// <summary> /// Adds a node as a TCP relay. /// This method can be used to initiate TCP connections to different ports on the same bootstrap node, or to add TCP relays without using them as bootstrap nodes. /// </summary> /// <param name="node">The node to add.</param> /// <param name="error"></param> /// <returns>True on success.</returns> public bool AddTcpRelay(ToxNode node, out ToxErrorBootstrap error) { ThrowIfDisposed(); if (node == null) throw new ArgumentNullException("node"); error = ToxErrorBootstrap.Ok; return ToxFunctions.AddTcpRelay(_tox, node.Address, (ushort)node.Port, node.PublicKey.GetBytes(), ref error); }
/// <summary> /// Attempts to bootstrap this Tox instance with a ToxNode. A 'getnodes' request is sent to the given node. /// </summary> /// <param name="node">The node to bootstrap off of.</param> /// <returns>True if the 'getnodes' request was sent successfully.</returns> public bool Bootstrap(ToxNode node) { var error = ToxErrorBootstrap.Ok; return Bootstrap(node, out error); }
/// <summary> /// Adds a node as a TCP relay. /// This method can be used to initiate TCP connections to different ports on the same bootstrap node, or to add TCP relays without using them as bootstrap nodes. /// </summary> /// <param name="node">The node to add.</param> /// <returns>True on success.</returns> public bool AddTcpRelay(ToxNode node) { var error = ToxErrorBootstrap.Ok; return AddTcpRelay(node, out error); }