diff --git a/NOnion/Cells/CellAuthChallenge.fs b/NOnion/Cells/CellAuthChallenge.fs index a3c54c36..d02ed149 100644 --- a/NOnion/Cells/CellAuthChallenge.fs +++ b/NOnion/Cells/CellAuthChallenge.fs @@ -20,12 +20,12 @@ type CellAuthChallenge = methods else readMethod - (methods @ [ ReadBigEndianUInt16 reader ]) + (ReadBigEndianUInt16 reader :: methods) (remainingCount - 1) let challenge = reader.ReadBytes Constants.ChallangeLength let methodsCount = ReadBigEndianUInt16 reader |> int - let methods = readMethod [] methodsCount + let methods = readMethod [] methodsCount |> Seq.rev { Challenge = challenge diff --git a/NOnion/Cells/CellCerts.fs b/NOnion/Cells/CellCerts.fs index ea2ba8ab..5ede9ef3 100644 --- a/NOnion/Cells/CellCerts.fs +++ b/NOnion/Cells/CellCerts.fs @@ -33,11 +33,11 @@ type CellCerts = } readCertificates - (certificates @ [ certificate ]) + (certificate :: certificates) (remainingCount - 1) let certificatesCount = reader.ReadByte() |> int - let certs = readCertificates List.empty certificatesCount + let certs = readCertificates List.empty certificatesCount |> Seq.rev { Certs = certs diff --git a/NOnion/Cells/CellNetInfo.fs b/NOnion/Cells/CellNetInfo.fs index 9e72670f..feb3dd6d 100644 --- a/NOnion/Cells/CellNetInfo.fs +++ b/NOnion/Cells/CellNetInfo.fs @@ -32,13 +32,13 @@ type CellNetInfo = addresses else readAddresses - (addresses @ [ readAddress() ]) + (readAddress() :: addresses) (remainingCount - 1uy) let time = ReadBigEndianUInt32 reader let otherAddress = readAddress() let myAddressesCount = reader.ReadByte() - let myAddresses = readAddresses List.Empty myAddressesCount + let myAddresses = readAddresses List.Empty myAddressesCount |> Seq.rev { Time = time diff --git a/NOnion/Cells/CellVersions.fs b/NOnion/Cells/CellVersions.fs index 99111348..ec72dda2 100644 --- a/NOnion/Cells/CellVersions.fs +++ b/NOnion/Cells/CellVersions.fs @@ -22,9 +22,9 @@ type CellVersions = if reader.BaseStream.Length = reader.BaseStream.Position then versions else - readVersions(versions @ [ ReadBigEndianUInt16 reader ]) + readVersions((ReadBigEndianUInt16 reader) :: versions) - let versions = readVersions List.empty + let versions = readVersions List.empty |> Seq.rev { Versions = versions diff --git a/NOnion/Cells/Relay/RelayEstablishIntro.fs b/NOnion/Cells/Relay/RelayEstablishIntro.fs index 73c1871f..454ff216 100644 --- a/NOnion/Cells/Relay/RelayEstablishIntro.fs +++ b/NOnion/Cells/Relay/RelayEstablishIntro.fs @@ -133,11 +133,10 @@ type RelayEstablishIntro = state else readExtensionsList - (state - @ List.singleton(RelayIntroExtension.FromBytes reader)) + ((RelayIntroExtension.FromBytes reader) :: state) (remainingCount - 1uy) - readExtensionsList List.empty extensionCount + readExtensionsList List.empty extensionCount |> Seq.rev let handshakeAuth = reader.ReadBytes authKey.MacLength diff --git a/NOnion/Cells/Relay/RelayIntroduce.fs b/NOnion/Cells/Relay/RelayIntroduce.fs index d45f3ada..181b3ff1 100644 --- a/NOnion/Cells/Relay/RelayIntroduce.fs +++ b/NOnion/Cells/Relay/RelayIntroduce.fs @@ -25,8 +25,7 @@ type RelayIntroduceInnerData = state else readExtensionsList - (state - @ List.singleton(RelayIntroExtension.FromBytes reader)) + ((RelayIntroExtension.FromBytes reader) :: state) (remainingCount - 1uy) readExtensionsList List.empty extensionCount @@ -105,8 +104,7 @@ type RelayIntroduce = state else readExtensionsList - (state - @ List.singleton(RelayIntroExtension.FromBytes reader)) + ((RelayIntroExtension.FromBytes reader)::state) (remainingCount - 1uy) readExtensionsList List.empty extensionCount diff --git a/NOnion/Cells/Relay/RelayIntroduceAck.fs b/NOnion/Cells/Relay/RelayIntroduceAck.fs index 7de51eda..b4d861ce 100644 --- a/NOnion/Cells/Relay/RelayIntroduceAck.fs +++ b/NOnion/Cells/Relay/RelayIntroduceAck.fs @@ -26,8 +26,7 @@ type RelayIntroduceAck = state else readExtensionsList - (state - @ List.singleton(RelayIntroExtension.FromBytes reader)) + (((RelayIntroExtension.FromBytes reader)) :: state) (remainingCount - 1uy) readExtensionsList List.empty extensionCount diff --git a/NOnion/Directory/HiddenServiceDescriptorDocument.fs b/NOnion/Directory/HiddenServiceDescriptorDocument.fs index 1fe9894e..3eae43ab 100644 --- a/NOnion/Directory/HiddenServiceDescriptorDocument.fs +++ b/NOnion/Directory/HiddenServiceDescriptorDocument.fs @@ -246,8 +246,7 @@ type HiddenServiceDescriptorDocument = | "introduction-point" -> { state with IntroductionPoints = - state.IntroductionPoints - @ List.singleton(IntroductionPointEntry.Parse lines) + (IntroductionPointEntry.Parse lines) :: state.IntroductionPoints } | _ -> lines.Dequeue() |> ignore diff --git a/NOnion/Network/TorCircuit.fs b/NOnion/Network/TorCircuit.fs index 0b81f7e4..fe6b1a2c 100644 --- a/NOnion/Network/TorCircuit.fs +++ b/NOnion/Network/TorCircuit.fs @@ -673,17 +673,15 @@ type TorCircuit circuitState <- Ready( circuitId, - nodes - @ List.singleton - { - TorCircuitNode.CryptoState = - TorCryptoState.FromKdfResult - (Kdf.ComputeHSKdf ntorKeySeed) - true - Window = - TorWindow - Constants.DefaultCircuitLevelWindowParams - } + { + TorCircuitNode.CryptoState = + TorCryptoState.FromKdfResult + (Kdf.ComputeHSKdf ntorKeySeed) + true + Window = + TorWindow + Constants.DefaultCircuitLevelWindowParams + } :: nodes ) do! @@ -785,17 +783,15 @@ type TorCircuit circuitState <- Ready( circuitId, - nodes - @ List.singleton - { - TorCircuitNode.CryptoState = - TorCryptoState.FromKdfResult - kdfResult - false - Window = - TorWindow - Constants.DefaultCircuitLevelWindowParams - } + { + TorCircuitNode.CryptoState = + TorCryptoState.FromKdfResult + kdfResult + false + Window = + TorWindow + Constants.DefaultCircuitLevelWindowParams + } :: nodes ) tcs.SetResult circuitId @@ -960,8 +956,6 @@ type TorCircuit circuitState <- Ready( circuitId, - nodes - @ List.singleton { TorCircuitNode.CryptoState = TorCryptoState.FromKdfResult @@ -971,7 +965,7 @@ type TorCircuit Window = TorWindow Constants.DefaultCircuitLevelWindowParams - } + } :: nodes ) tcs.SetResult()