diff --git a/RageCoop.Client/Main.cs b/RageCoop.Client/Main.cs index 8ef1acf..30df1d1 100644 --- a/RageCoop.Client/Main.cs +++ b/RageCoop.Client/Main.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Drawing; using System.Linq; using System.Windows.Forms; using System.Threading.Tasks; @@ -168,18 +169,13 @@ namespace RageCoop.Client Main.Logger.Error(ex); } - - -#if DEBUG if (Networking.ShowNetworkInfo) { - + new LemonUI.Elements.ScaledText(new PointF(Screen.PrimaryScreen.Bounds.Width / 2, 0), $"L: {Networking.Latency * 1000:N0}ms", 0.5f) { Alignment = GTA.UI.Alignment.Center }.Draw(); new LemonUI.Elements.ScaledText(new PointF(Screen.PrimaryScreen.Bounds.Width / 2, 30), $"R: {Lidgren.Network.NetUtility.ToHumanReadable(Statistics.BytesDownPerSecond)}/s", 0.5f) { Alignment = GTA.UI.Alignment.Center }.Draw(); new LemonUI.Elements.ScaledText(new PointF(Screen.PrimaryScreen.Bounds.Width / 2, 60), $"S: {Lidgren.Network.NetUtility.ToHumanReadable(Statistics.BytesUpPerSecond)}/s", 0.5f) { Alignment = GTA.UI.Alignment.Center }.Draw(); } -#endif - MainChat.Tick(); diff --git a/RageCoop.Client/Networking/Networking.cs b/RageCoop.Client/Networking/Networking.cs index cd420f9..a581d53 100644 --- a/RageCoop.Client/Networking/Networking.cs +++ b/RageCoop.Client/Networking/Networking.cs @@ -59,7 +59,8 @@ namespace RageCoop.Client // 623c92c287cc392406e7aaaac1c0f3b0 = RAGECOOP NetPeerConfiguration config = new NetPeerConfiguration("623c92c287cc392406e7aaaac1c0f3b0") { - AutoFlushSendQueue = false + AutoFlushSendQueue = false, + SimulatedMinimumLatency =0.3f }; config.EnableMessageType(NetIncomingMessageType.UnconnectedData); diff --git a/RageCoop.Client/Sync/Entities/SyncedVehicle.cs b/RageCoop.Client/Sync/Entities/SyncedVehicle.cs index 3a64dde..8501786 100644 --- a/RageCoop.Client/Sync/Entities/SyncedVehicle.cs +++ b/RageCoop.Client/Sync/Entities/SyncedVehicle.cs @@ -364,12 +364,13 @@ namespace RageCoop.Client LastVelocity=_predictedVel; var current = MainVehicle.ReadPosition(); var dist = current.DistanceTo(Position); - var cali = dist*(_predictedPos - current); + var cali = (dist<1?dist*4:dist)*(_predictedPos - current); // new LemonUI.Elements.ScaledText(new System.Drawing.PointF(50, 50), dist.ToString()).Draw(); if (dist<8) { - MainVehicle.Velocity = _predictedVel+cali; + MainVehicle.Velocity = _predictedVel; + MainVehicle.ApplyForce(cali); if (IsFlipped) { MainVehicle.Quaternion=Quaternion.Slerp(MainVehicle.ReadQuaternion(), Quaternion, 0.5f); diff --git a/libs/Lidgren.Network.XML b/libs/Lidgren.Network.XML new file mode 100644 index 0000000..ec2ca72 --- /dev/null +++ b/libs/Lidgren.Network.XML @@ -0,0 +1,2559 @@ + + + + Lidgren.Network + + + + + Base for a non-threadsafe encryption class + + + + + Block size in bytes for this cipher + + + + + NetBlockEncryptionBase constructor + + + + + Encrypt am outgoing message with this algorithm; no writing can be done to the message after encryption, or message will be corrupted + + + + + Decrypt an incoming message encrypted with corresponding Encrypt + + message to decrypt + true if successful; false if failed + + + + Encrypt a block of bytes + + + + + Decrypt a block of bytes + + + + + Interface for an encryption algorithm + + + + + NetPeer + + + + + Constructor + + + + + Encrypt an outgoing message in place + + + + + Decrypt an incoming message in place + + + + + Example class; not very good encryption + + + + + NetXorEncryption constructor + + + + + NetXorEncryption constructor + + + + + Encrypt an outgoing message + + + + + Decrypt an incoming message + + + + + Methods to encrypt and decrypt data using the XTEA algorithm + + + + + Gets the block size for this cipher + + + + + 16 byte key + + + + + 16 byte key + + + + + String to hash for key + + + + + Encrypts a block of bytes + + + + + Decrypts a block of bytes + + + + + Lidgren Network Library + + + + + Big integer class based on BouncyCastle (http://www.bouncycastle.org) big integer code + + + + + Fixed size vector of booleans + + + + + Gets the number of bits/booleans stored in this vector + + + + + NetBitVector constructor + + + + + Returns true if all bits/booleans are set to zero/false + + + + + Returns the number of bits/booleans set to one/true + + + + + + Shift all bits one step down, cycling the first bit to the top + + + + + Gets the first (lowest) index set to true + + + + + Gets the bit/bool at the specified index + + + + + Sets or clears the bit/bool at the specified index + + + + + Gets the bit/bool at the specified index + + + + + Sets all bits/booleans to zero/false + + + + + Returns a string that represents this object + + + + + Helper class for NetBuffer to write/read bits + + + + + Read 1-8 bits from a buffer into a byte + + + + + Read several bytes from a buffer + + + + + Write 0-8 bits of data to buffer + + + + + Write several whole bytes + + + + + Reads an unsigned 16 bit integer + + + + + Reads the specified number of bits into an UInt32 + + + + + Writes an unsigned 16 bit integer + + + + + Writes the specified number of bits into a byte array + + + + + Writes the specified number of bits into a byte array + + + + + Write Base128 encoded variable sized unsigned integer + + number of bytes written + + + + Reads a UInt32 written using WriteUnsignedVarInt(); will increment offset! + + + + + Base class for NetIncomingMessage and NetOutgoingMessage + + + + + Number of bytes to overallocate for each message to avoid resizing + + + + + Gets or sets the internal data buffer + + + + + Gets or sets the length of the used portion of the buffer in bytes + + + + + Gets or sets the length of the used portion of the buffer in bits + + + + + Gets or sets the read position in the buffer, in bits (not bytes) + + + + + Gets the position in the buffer in bytes; note that the bits of the first returned byte may already have been read - check the Position property to make sure. + + + + + Gets the internal data buffer + + + + + Reads a 1-bit Boolean without advancing the read pointer + + + + + Reads a Byte without advancing the read pointer + + + + + Reads an SByte without advancing the read pointer + + + + + Reads the specified number of bits into a Byte without advancing the read pointer + + + + + Reads the specified number of bytes without advancing the read pointer + + + + + Reads the specified number of bytes without advancing the read pointer + + + + + Reads an Int16 without advancing the read pointer + + + + + Reads a UInt16 without advancing the read pointer + + + + + Reads an Int32 without advancing the read pointer + + + + + Reads the specified number of bits into an Int32 without advancing the read pointer + + + + + Reads a UInt32 without advancing the read pointer + + + + + Reads the specified number of bits into a UInt32 without advancing the read pointer + + + + + Reads a UInt64 without advancing the read pointer + + + + + Reads an Int64 without advancing the read pointer + + + + + Reads the specified number of bits into an UInt64 without advancing the read pointer + + + + + Reads the specified number of bits into an Int64 without advancing the read pointer + + + + + Reads a 32-bit Single without advancing the read pointer + + + + + Reads a 32-bit Single without advancing the read pointer + + + + + Reads a 64-bit Double without advancing the read pointer + + + + + Reads a string without advancing the read pointer + + + + + Reads a boolean value (stored as a single bit) written using Write(bool) + + + + + Reads a byte + + + + + Reads a byte and returns true or false for success + + + + + Reads a signed byte + + + + + Reads 1 to 8 bits into a byte + + + + + Reads the specified number of bytes + + + + + Reads the specified number of bytes and returns true for success + + + + + Reads the specified number of bytes into a preallocated array + + The destination array + The offset where to start writing in the destination array + The number of bytes to read + + + + Reads the specified number of bits into a preallocated array + + The destination array + The offset where to start writing in the destination array + The number of bits to read + + + + Reads a 16 bit signed integer written using Write(Int16) + + + + + Reads a 16 bit unsigned integer written using Write(UInt16) + + + + + Reads a 32 bit signed integer written using Write(Int32) + + + + + Reads a 32 bit signed integer written using Write(Int32) + + + + + Reads a signed integer stored in 1 to 32 bits, written using Write(Int32, Int32) + + + + + Reads an 32 bit unsigned integer written using Write(UInt32) + + + + + Reads an 32 bit unsigned integer written using Write(UInt32) and returns true for success + + + + + Reads an unsigned integer stored in 1 to 32 bits, written using Write(UInt32, Int32) + + + + + Reads a 64 bit unsigned integer written using Write(UInt64) + + + + + Reads a 64 bit signed integer written using Write(Int64) + + + + + Reads an unsigned integer stored in 1 to 64 bits, written using Write(UInt64, Int32) + + + + + Reads a signed integer stored in 1 to 64 bits, written using Write(Int64, Int32) + + + + + Reads a 32 bit floating point value written using Write(Single) + + + + + Reads a 32 bit floating point value written using Write(Single) + + + + + Reads a 32 bit floating point value written using Write(Single) + + + + + Reads a 64 bit floating point value written using Write(Double) + + + + + Reads a variable sized UInt32 written using WriteVariableUInt32() + + + + + Reads a variable sized UInt32 written using WriteVariableUInt32() and returns true for success + + + + + Reads a variable sized Int32 written using WriteVariableInt32() + + + + + Reads a variable sized Int64 written using WriteVariableInt64() + + + + + Reads a variable sized UInt32 written using WriteVariableInt64() + + + + + Reads a 32 bit floating point value written using WriteSignedSingle() + + The number of bits used when writing the value + A floating point value larger or equal to -1 and smaller or equal to 1 + + + + Reads a 32 bit floating point value written using WriteUnitSingle() + + The number of bits used when writing the value + A floating point value larger or equal to 0 and smaller or equal to 1 + + + + Reads a 32 bit floating point value written using WriteRangedSingle() + + The minimum value used when writing the value + The maximum value used when writing the value + The number of bits used when writing the value + A floating point value larger or equal to MIN and smaller or equal to MAX + + + + Reads a 32 bit integer value written using WriteRangedInteger() + + The minimum value used when writing the value + The maximum value used when writing the value + A signed integer value larger or equal to MIN and smaller or equal to MAX + + + + Reads a 64 bit integer value written using WriteRangedInteger() (64 version) + + The minimum value used when writing the value + The maximum value used when writing the value + A signed integer value larger or equal to MIN and smaller or equal to MAX + + + + Reads a string written using Write(string) + + + + + Reads a string written using Write(string) and returns true for success + + + + + Reads a value, in local time comparable to NetTime.Now, written using WriteTime() for the connection supplied + + + + + Reads a stored IPv4 endpoint description + + + + + Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes. + + + + + Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes. + + + + + Pads data with the specified number of bits. + + + + + Reads all public and private declared instance fields of the object in alphabetical order using reflection + + + + + Reads all fields with the specified binding of the object in alphabetical order using reflection + + + + + Reads all public and private declared instance fields of the object in alphabetical order using reflection + + + + + Reads all fields with the specified binding of the object in alphabetical order using reflection + + + + + Ensures the buffer can hold this number of bits + + + + + Ensures the buffer can hold this number of bits + + + + + Writes a boolean value using 1 bit + + + + + Write a byte + + + + + Writes a byte at a given offset in the buffer + + + + + Writes a signed byte + + + + + Writes 1 to 8 bits of a byte + + + + + Writes all bytes in an array + + + + + Writes the specified number of bytes from an array + + + + + Writes an unsigned 16 bit integer + + + + + + Writes a 16 bit unsigned integer at a given offset in the buffer + + + + + Writes an unsigned integer using 1 to 16 bits + + + + + Writes a signed 16 bit integer + + + + + Writes a 16 bit signed integer at a given offset in the buffer + + + + + Writes a 32 bit signed integer + + + + + Writes a 32 bit signed integer at a given offset in the buffer + + + + + Writes a 32 bit unsigned integer + + + + + Writes a 32 bit unsigned integer at a given offset in the buffer + + + + + Writes a 32 bit signed integer + + + + + Writes a signed integer using 1 to 32 bits + + + + + Writes a 64 bit unsigned integer + + + + + Writes a 64 bit unsigned integer at a given offset in the buffer + + + + + Writes an unsigned integer using 1 to 64 bits + + + + + Writes a 64 bit signed integer + + + + + Writes a signed integer using 1 to 64 bits + + + + + Writes a 32 bit floating point value + + + + + Writes a 64 bit floating point value + + + + + Write Base128 encoded variable sized unsigned integer of up to 32 bits + + number of bytes written + + + + Write Base128 encoded variable sized signed integer of up to 32 bits + + number of bytes written + + + + Write Base128 encoded variable sized signed integer of up to 64 bits + + number of bytes written + + + + Write Base128 encoded variable sized unsigned integer of up to 64 bits + + number of bytes written + + + + Compress (lossy) a float in the range -1..1 using numberOfBits bits + + + + + Compress (lossy) a float in the range 0..1 using numberOfBits bits + + + + + Compress a float within a specified range using a certain number of bits + + + + + Writes an integer with the least amount of bits need for the specified range + Returns number of bits written + + + + + Writes an integer with the least amount of bits need for the specified range + Returns number of bits written + + + + + Write a string + + + + + Writes an endpoint description + + + + + Writes the current local time to a message; readable (and convertable to local time) by the remote host using ReadTime() + + + + + Writes a local timestamp to a message; readable (and convertable to local time) by the remote host using ReadTime() + + + + + Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes. + + + + + Pads data with the specified number of bits. + + + + + Append all the bits of message to this message + + + + + Writes all public and private declared instance fields of the object in alphabetical order using reflection + + + + + Writes all fields with specified binding in alphabetical order using reflection + + + + + Writes all public and private declared instance properties of the object in alphabetical order using reflection + + + + + Writes all properties with specified binding in alphabetical order using reflection + + + + + Utility struct for writing Singles + + + + + Value as a 32 bit float + + + + + Value as an unsigned 32 bit integer + + + + + Specialized version of NetPeer used for a "client" connection. It does not accept any incoming connections and maintains a ServerConnection property + + + + + Gets the connection to the server, if any + + + + + Gets the connection status of the server connection (or NetConnectionStatus.Disconnected if no connection) + + + + + NetClient constructor + + + + + + Connect to a remote server + + The remote endpoint to connect to + The hail message to pass + server connection, or null if already connected + + + + Disconnect from server + + reason for disconnect + + + + Sends message to server + + + + + Sends message to server + + + + + Returns a string that represents this object + + + + + Represents a connection to a remote peer + + + + + Gets or sets the application defined object containing data about the connection + + + + + Gets the peer which holds this connection + + + + + Gets the current status of the connection (synced to the last status message read) + + + + + Gets various statistics for this connection + + + + + Gets the remote endpoint for the connection + + + + + Gets the unique identifier of the remote NetPeer for this connection + + + + + Gets the local hail message that was sent as part of the handshake + + + + + Change the internal endpoint to this new one. Used when, during handshake, a switch in port is detected (due to NAT) + + + + + Send a message to this remote connection + + The message to send + How to deliver the message + Sequence channel within the delivery method + + + + Zero windowSize indicates that the channel is not yet instantiated (used) + Negative freeWindowSlots means this amount of messages are currently queued but delayed due to closed window + + + + + Returns a string that represents this object + + + + + The message that the remote part specified via Connect() or Approve() - can be null. + + + + + Approves this connection; sending a connection response to the remote host + + + + + Approves this connection; sending a connection response to the remote host + + The local hail message that will be set as RemoteHailMessage on the remote host + + + + Denies this connection; disconnecting it + + + + + Denies this connection; disconnecting it + + The stated reason for the disconnect, readable as a string in the StatusChanged message on the remote host + + + + Disconnect from the remote peer + + the message to send with the disconnect message + + + + Gets the current average roundtrip time in seconds + + + + + Time offset between this peer and the remote peer + + + + + Gets local time value comparable to NetTime.Now from a remote value + + + + + Gets the remote time value for a local time value produced by NetTime.Now + + + + + Gets the current MTU in bytes. If PeerConfiguration.AutoExpandMTU is false, this will be PeerConfiguration.MaximumTransmissionUnit. + + + + + Statistics for a NetConnection instance + + + + + Gets the number of sent packets for this connection + + + + + Gets the number of received packets for this connection + + + + + Gets the number of sent bytes for this connection + + + + + Gets the number of received bytes for this connection + + + + + Gets the number of sent messages for this connection + + + + + Gets the number of received messages for this connection + + + + + Gets the number of resent reliable messages for this connection + + + + + Gets the number of dropped messages for this connection + + + + + Returns a string that represents this object + + + + + Status for a NetConnection instance + + + + + No connection, or attempt, in place + + + + + Connect has been sent; waiting for ConnectResponse + + + + + Connect was received, but ConnectResponse hasn't been sent yet + + + + + Connect was received and ApprovalMessage released to the application; awaiting Approve() or Deny() + + + + + Connect was received and ConnectResponse has been sent; waiting for ConnectionEstablished + + + + + Connected + + + + + In the process of disconnecting + + + + + Disconnected + + + + + All the constants used when compiling the library + + + + + Number of channels which needs a sequence number to work + + + + + Number of reliable channels + + + + + How the library deals with resends and handling of late messages + + + + + Indicates an error + + + + + Unreliable, unordered delivery + + + + + Unreliable delivery, but automatically dropping late messages + + + + + Reliable delivery, but unordered + + + + + Reliable delivery, except for late messages which are dropped + + + + + Reliable, ordered delivery + + + + + Exception thrown in the Lidgren Network Library + + + + + NetException constructor + + + + + NetException constructor + + + + + NetException constructor + + + + + Throws an exception, in DEBUG only, if first parameter is false + + + + + Throws an exception, in DEBUG only, if first parameter is false + + + + + Incoming message either sent from a remote peer or generated within the library + + + + + Gets the type of this incoming message + + + + + Gets the delivery method this message was sent with (if user data) + + + + + Gets the sequence channel this message was sent with (if user data) + + + + + endpoint of sender, if any + + + + + NetConnection of sender, if any + + + + + What local time the message was received from the network + + + + + Decrypt a message + + The encryption algorithm used to encrypt the message + true on success + + + + Reads a value, in local time comparable to NetTime.Now, written using WriteTime() + Must have a connected sender + + + + + Returns a string that represents this object + + + + + The type of a NetIncomingMessage + + + + + Error; this value should never appear + + + + + Status for a connection changed + + + + + Data sent using SendUnconnectedMessage + + + + + Connection approval is needed + + + + + Application data + + + + + Receipt of delivery + + + + + Discovery request for a response + + + + + Discovery response to a request + + + + + Verbose debug message + + + + + Debug message + + + + + Warning message + + + + + Error message + + + + + NAT introduction was successful + + + + + A roundtrip was measured and NetConnection.AverageRoundtripTime was updated + + + + + Represents a local peer capable of holding zero, one or more connections to remote peers + + + + + Send NetIntroduction to hostExternal and clientExternal; introducing client to host + + + + + Called when host/client receives a NatIntroduction message from a master server + + + + + Called when receiving a NatPunchMessage from a remote endpoint + + + + + Gets the NetPeerStatus of the NetPeer + + + + + Signalling event which can be waited on to determine when a message is queued for reading. + Note that there is no guarantee that after the event is signaled the blocked thread will + find the message in the queue. Other user created threads could be preempted and dequeue + the message before the waiting thread wakes up. + + + + + Gets a unique identifier for this NetPeer based on Mac address and ip/port. Note! Not available until Start() has been called! + + + + + Gets the port number this NetPeer is listening and sending on, if Start() has been called + + + + + Returns an UPnP object if enabled in the NetPeerConfiguration + + + + + Gets or sets the application defined object containing data about the peer + + + + + Gets a copy of the list of connections + + + + + Gets the number of active connections + + + + + Statistics on this NetPeer since it was initialized + + + + + Gets the configuration used to instanciate this NetPeer + + + + + NetPeer constructor + + + + + Binds to socket and spawns the networking thread + + + + + Get the connection, if any, for a certain remote endpoint + + + + + Read a pending message from any connection, blocking up to maxMillis if needed + + + + + Read a pending message from any connection, if any + + + + + Reads a pending message from any connection, if any. + Returns true if message was read, otherwise false. + + True, if message was read. + + + + Read a pending message from any connection, if any + + + + + Create a connection to a remote endpoint + + + + + Create a connection to a remote endpoint + + + + + Create a connection to a remote endpoint + + + + + Create a connection to a remote endpoint + + + + + Send raw bytes; only used for debugging + + + + + In DEBUG, throws an exception, in RELEASE logs an error message + + + + + + Disconnects all active connections and closes the socket + + + + + Emit a discovery signal to all hosts on your subnet + + + + + Emit a discovery signal to a single known host + + + + + Emit a discovery signal to a single known host + + + + + Send a discovery response message + + + + + Gets the socket, if Start() has been called + + + + + Call this to register a callback for when a new message arrives + + + + + Call this to unregister a callback, but remember to do it in the same synchronization context! + + + + + If NetPeerConfiguration.AutoFlushSendQueue() is false; you need to call this to send all messages queued using SendMessage() + + + + + Creates a new message for sending + + + + + Creates a new message for sending and writes the provided string to it + + + + + Creates a new message for sending + + initial capacity in bytes + + + + Recycles a NetIncomingMessage instance for reuse; taking pressure off the garbage collector + + + + + Recycles a list of NetIncomingMessage instances for reuse; taking pressure off the garbage collector + + + + + Creates an incoming message with the required capacity for releasing to the application + + + + + Send a message to a specific connection + + The message to send + The recipient connection + How to deliver the message + + + + Send a message to a specific connection + + The message to send + The recipient connection + How to deliver the message + Sequence channel within the delivery method + + + + Send a message to a list of connections + + The message to send + The list of recipients to send to + How to deliver the message + Sequence channel within the delivery method + + + + Send a message to an unconnected host + + + + + Send a message to an unconnected host + + + + + Send a message to an unconnected host + + + + + Send a message to this exact same netpeer (loopback) + + + + + Outgoing message used to send data to remote peer(s) + + + + + Encrypt this message using the provided algorithm; no more writing can be done before sending it or the message will be corrupt! + + + + + Returns a string that represents this object + + + + + Partly immutable after NetPeer has been initialized + + + + + Default MTU value in bytes + + + + + NetPeerConfiguration constructor + + + + + Gets the identifier of this application; the library can only connect to matching app identifier peers + + + + + Enables receiving of the specified type of message + + + + + Disables receiving of the specified type of message + + + + + Enables or disables receiving of the specified type of message + + + + + Gets if receiving of the specified type of message is enabled + + + + + Gets or sets the behaviour of unreliable sends above MTU + + + + + Gets or sets the name of the library network thread. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the maximum amount of connections this peer can hold. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the maximum amount of bytes to send in a single packet, excluding ip, udp and lidgren headers. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the default capacity in bytes when NetPeer.CreateMessage() is called without argument + + + + + Gets or sets the time between latency calculating pings + + + + + Gets or sets if the library should recycling messages to avoid excessive garbage collection. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the maximum number of incoming/outgoing messages to keep in the recycle cache. + + + + + Gets or sets the number of seconds timeout will be postponed on a successful ping/pong + + + + + Enables UPnP support; enabling port forwarding and getting external ip + + + + + Enables or disables automatic flushing of the send queue. If disabled, you must manully call NetPeer.FlushSendQueue() to flush sent messages to network. + + + + + If true, will not send acks for unreliable unordered messages. This will save bandwidth, but disable flow control and duplicate detection for this type of messages. + + + + + Gets or sets the local ip address to bind to. Defaults to IPAddress.Any. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets a value indicating whether the library should use IPv6 dual stack mode. + If you enable this you should make sure that the is an IPv6 address. + Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the local broadcast address to use when broadcasting + + + + + Gets or sets the local port to bind to. Defaults to 0. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the size in bytes of the receiving buffer. Defaults to 131071 bytes. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets the size in bytes of the sending buffer. Defaults to 131071 bytes. Cannot be changed once NetPeer is initialized. + + + + + Gets or sets if the NetPeer should accept incoming connections. This is automatically set to true in NetServer and false in NetClient. + + + + + Gets or sets the number of seconds between handshake attempts + + + + + Gets or sets the maximum number of handshake attempts before failing to connect + + + + + Gets or sets if the NetPeer should send large messages to try to expand the maximum transmission unit size + + + + + Gets or sets how often to send large messages to expand MTU if AutoExpandMTU is enabled + + + + + Gets or sets the number of failed expand mtu attempts to perform before setting final MTU + + + + + Gets or sets the simulated amount of sent packets lost from 0.0f to 1.0f + + + + + Gets or sets the minimum simulated amount of one way latency for sent packets in seconds + + + + + Gets or sets the simulated added random amount of one way latency for sent packets in seconds + + + + + Gets the average simulated one way latency in seconds + + + + + Gets or sets the simulated amount of duplicated packets from 0.0f to 1.0f + + + + + Creates a memberwise shallow clone of this configuration + + + + + Behaviour of unreliable sends above MTU + + + + + Sending an unreliable message will ignore MTU and send everything in a single packet; this is the new default + + + + + Old behaviour; use normal fragmentation for unreliable messages - if a fragment is dropped, memory for received fragments are never reclaimed! + + + + + Alternate behaviour; just drops unreliable messages above MTU + + + + + Statistics for a NetPeer instance + + + + + Gets the number of sent packets since the NetPeer was initialized + + + + + Gets the number of received packets since the NetPeer was initialized + + + + + Gets the number of sent messages since the NetPeer was initialized + + + + + Gets the number of received messages since the NetPeer was initialized + + + + + Gets the number of sent bytes since the NetPeer was initialized + + + + + Gets the number of received bytes since the NetPeer was initialized + + + + + Gets the number of bytes allocated (and possibly garbage collected) for message storage + + + + + Gets the number of bytes in the recycled pool + + + + + Returns a string that represents this object + + + + + Status for a NetPeer instance + + + + + NetPeer is not running; socket is not bound + + + + + NetPeer is in the process of starting up + + + + + NetPeer is bound to socket and listening for packets + + + + + Shutdown has been requested and will be executed shortly + + + + + Thread safe (blocking) expanding queue with TryDequeue() and EnqueueFirst() + + + + + Gets the number of items in the queue + + + + + Gets the current capacity for the queue + + + + + NetQueue constructor + + + + + Adds an item last/tail of the queue + + + + + Adds an item last/tail of the queue + + + + + Places an item first, at the head of the queue + + + + + Gets an item from the head of the queue, or returns default(T) if empty + + + + + Gets all items from the head of the queue, or returns number of items popped + + + + + Returns default(T) if queue is empty + + + + + Determines whether an item is in the queue + + + + + Copies the queue items to a new array + + + + + Removes all objects from the queue + + + + + NetRandom base class + + + + + Get global instance of NetRandom (uses MWCRandom) + + + + + Constructor with randomized seed + + + + + Constructor with provided 32 bit seed + + + + + (Re)initialize this instance with provided 32 bit seed + + + + + Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively + + + + + Generates a random value that is greater or equal than 0 and less than Int32.MaxValue + + + + + Generates a random value greater or equal than 0 and less or equal than Int32.MaxValue (inclusively) + + + + + Returns random value larger or equal to 0.0 and less than 1.0 + + + + + Returns random value is greater or equal than 0.0 and less than 1.0 + + + + + Returns random value is greater or equal than 0.0f and less than 1.0f + + + + + Returns a random value is greater or equal than 0 and less than maxValue + + + + + Returns a random value is greater or equal than minValue and less than maxValue + + + + + Generates a random value between UInt64.MinValue to UInt64.MaxValue + + + + + Returns true or false, randomly + + + + + Fills all bytes from offset to offset + length in buffer with random values + + + + + Fill the specified buffer with random values + + + + + Multiply With Carry random + + + + + Get global instance of MWCRandom + + + + + Constructor with randomized seed + + + + + (Re)initialize this instance with provided 32 bit seed + + + + + (Re)initialize this instance with provided 64 bit seed + + + + + Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively + + + + + Xor Shift based random + + + + + Get global instance of XorShiftRandom + + + + + Constructor with randomized seed + + + + + Constructor with provided 64 bit seed + + + + + (Re)initialize this instance with provided 32 bit seed + + + + + (Re)initialize this instance with provided 64 bit seed + + + + + Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively + + + + + Mersenne Twister based random + + + + + Get global instance of MersenneTwisterRandom + + + + + Constructor with randomized seed + + + + + Constructor with provided 32 bit seed + + + + + (Re)initialize this instance with provided 32 bit seed + + + + + Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively + + + + + RNGCryptoServiceProvider based random; very slow but cryptographically safe + + + + + Global instance of CryptoRandom + + + + + Seed in CryptoRandom does not create deterministic sequences + + + + + Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively + + + + + Fill the specified buffer with random values + + + + + Fills all bytes from offset to offset + length in buffer with random values + + + + + Class for generating random seeds + + + + + Generates a 32 bit random seed + + + + + Generates a 64 bit random seed + + + + + Sender part of Selective repeat ARQ for a particular NetChannel + + + + + Result of a SendMessage call + + + + + Message failed to enqueue because there is no connection + + + + + Message was immediately sent + + + + + Message was queued for delivery + + + + + Message was dropped immediately since too many message were queued + + + + + Specialized version of NetPeer used for "server" peers + + + + + NetServer constructor + + + + + Send a message to all connections + + The message to send + How to deliver the message + + + + Send a message to all connections + + The message to send + How to deliver the message + Which sequence channel to use for the message + + + + Send a message to all connections except one + + The message to send + How to deliver the message + Don't send to this particular connection + Which sequence channel to use for the message + + + + Returns a string that represents this object + + + + + Helper methods for implementing SRP authentication + + + + + Compute multiplier (k) + + + + + Create 16 bytes of random salt + + + + + Create 32 bytes of random ephemeral value + + + + + Computer private key (x) + + + + + Creates a verifier that the server can later use to authenticate users later on (v) + + + + + Compute client public ephemeral value (A) + + + + + Compute server ephemeral value (B) + + + + + Compute intermediate value (u) + + + + + Computes the server session value + + + + + Computes the client session value + + + + + Create XTEA symmetrical encryption object from sessionValue + + + + + Time service + + + + + Given seconds it will output a human friendly readable string (milliseconds if less than 60 seconds) + + + + + Get number of seconds since the application started + + + + + Sender part of Selective repeat ARQ for a particular NetChannel + + + + + Status of the UPnP capabilities + + + + + Still discovering UPnP capabilities + + + + + UPnP is not available + + + + + UPnP is available and ready to use + + + + + UPnP support class + + + + + Status of the UPnP capabilities of this NetPeer + + + + + NetUPnP constructor + + + + + Add a forwarding rule to the router using UPnP + + The external, WAN facing, port + A description for the port forwarding rule + The port on the client machine to send traffic to + + + + Delete a forwarding rule from the router using UPnP + + The external, 'internet facing', port + + + + Retrieve the extern ip using UPnP + + + + + Utility methods + + + + + Resolve endpoint callback + + + + + Resolve address callback + + + + + Get IPv4 endpoint from notation (xxx.xxx.xxx.xxx) or hostname and port number (asynchronous version) + + + + + Get IPv4 endpoint from notation (xxx.xxx.xxx.xxx) or hostname and port number + + + + + Get IPv4 address from notation (xxx.xxx.xxx.xxx) or hostname (asynchronous version) + + + + + Get IPv4 address from notation (xxx.xxx.xxx.xxx) or hostname + + + + + Create a hex string from an Int64 value + + + + + Create a hex string from an array of bytes + + + + + Create a hex string from an array of bytes + + + + + Returns true if the endpoint supplied is on the same subnet as this host + + + + + Returns true if the IPAddress supplied is on the same subnet as this host + + + + + Returns how many bits are necessary to hold a certain number + + + + + Returns how many bits are necessary to hold a certain number + + + + + Returns how many bytes are required to hold a certain number of bits + + + + + Convert a hexadecimal string to a byte array + + + + + Converts a number of bytes to a shorter, more readable string representation + + + + + Gets the window size used internally in the library for a certain delivery method + + + + + Creates a comma delimited string from a lite of items + + + + + Copies from to . Maps to an IPv6 address + + Source. + Destination. + + + + Maps the IPEndPoint object to an IPv6 address. Has allocation + + + + + If available, returns the bytes of the physical (MAC) address for the first usable network interface + + + + + Gets my local IPv4 address (not necessarily external) and subnet mask + + + + diff --git a/libs/Lidgren.Network.deps.json b/libs/Lidgren.Network.deps.json new file mode 100644 index 0000000..fcae17e --- /dev/null +++ b/libs/Lidgren.Network.deps.json @@ -0,0 +1,72 @@ +{ + "runtimeTarget": { + "name": ".NETStandard,Version=v2.0/", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETStandard,Version=v2.0": {}, + ".NETStandard,Version=v2.0/": { + "Lidgren.Network/1.0.0": { + "dependencies": { + "Microsoft.CSharp": "4.7.0", + "Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers": "0.4.336902", + "NETStandard.Library": "2.0.3" + }, + "runtime": { + "Lidgren.Network.dll": {} + } + }, + "Microsoft.CSharp/4.7.0": { + "runtime": { + "lib/netstandard2.0/Microsoft.CSharp.dll": { + "assemblyVersion": "4.0.5.0", + "fileVersion": "4.700.19.56404" + } + } + }, + "Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers/0.4.336902": {}, + "Microsoft.NETCore.Platforms/1.1.0": {}, + "NETStandard.Library/2.0.3": { + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + } + } + }, + "libraries": { + "Lidgren.Network/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Microsoft.CSharp/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", + "path": "microsoft.csharp/4.7.0", + "hashPath": "microsoft.csharp.4.7.0.nupkg.sha512" + }, + "Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers/0.4.336902": { + "type": "package", + "serviceable": true, + "sha512": "sha512-urQDGvwM6vNBClOu8dChtE7fELONWafH5rQOwO2A9YmBgEcbM8qfeaUqALLM4DKnxIu3J2Vm0GkBsApTSwWDog==", + "path": "microsoft.dotnet.upgradeassistant.extensions.default.analyzers/0.4.336902", + "hashPath": "microsoft.dotnet.upgradeassistant.extensions.default.analyzers.0.4.336902.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/1.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==", + "path": "microsoft.netcore.platforms/1.1.0", + "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512" + }, + "NETStandard.Library/2.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "path": "netstandard.library/2.0.3", + "hashPath": "netstandard.library.2.0.3.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/libs/Lidgren.Network.dll b/libs/Lidgren.Network.dll index 12eb9c3..f5092fd 100644 Binary files a/libs/Lidgren.Network.dll and b/libs/Lidgren.Network.dll differ diff --git a/libs/Lidgren.Network.pdb b/libs/Lidgren.Network.pdb new file mode 100644 index 0000000..4b90f31 Binary files /dev/null and b/libs/Lidgren.Network.pdb differ