From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../thrift/tutorial/netstd/.gitignore | 1 + .../thrift/tutorial/netstd/Client/Client.csproj | 41 ++ .../thrift/tutorial/netstd/Client/Program.cs | 409 ++++++++++++++++++ .../netstd/Client/Properties/AssemblyInfo.cs | 40 ++ .../netstd/Client/Properties/launchSettings.json | 8 + .../thrift/tutorial/netstd/Client/ThriftTest.pfx | Bin 0 -> 2661 bytes .../thrift/tutorial/netstd/Interfaces/.gitignore | 3 + .../tutorial/netstd/Interfaces/Interfaces.csproj | 48 +++ .../netstd/Interfaces/Properties/AssemblyInfo.cs | 40 ++ .../thrift/tutorial/netstd/Makefile.am | 42 ++ src/jaegertracing/thrift/tutorial/netstd/README.md | 284 ++++++++++++ .../thrift/tutorial/netstd/Server/Program.cs | 479 +++++++++++++++++++++ .../netstd/Server/Properties/AssemblyInfo.cs | 40 ++ .../netstd/Server/Properties/launchSettings.json | 8 + .../thrift/tutorial/netstd/Server/Server.csproj | 44 ++ .../thrift/tutorial/netstd/Server/ThriftTest.pfx | Bin 0 -> 2661 bytes .../thrift/tutorial/netstd/Tutorial.sln | 78 ++++ src/jaegertracing/thrift/tutorial/netstd/build.cmd | 25 ++ src/jaegertracing/thrift/tutorial/netstd/build.sh | 26 ++ 19 files changed, 1616 insertions(+) create mode 100644 src/jaegertracing/thrift/tutorial/netstd/.gitignore create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Client/Client.csproj create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Client/Program.cs create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Client/Properties/AssemblyInfo.cs create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Client/Properties/launchSettings.json create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Client/ThriftTest.pfx create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Interfaces/.gitignore create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Interfaces/Interfaces.csproj create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Interfaces/Properties/AssemblyInfo.cs create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Makefile.am create mode 100644 src/jaegertracing/thrift/tutorial/netstd/README.md create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Server/Program.cs create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Server/Properties/AssemblyInfo.cs create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Server/Properties/launchSettings.json create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Server/Server.csproj create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Server/ThriftTest.pfx create mode 100644 src/jaegertracing/thrift/tutorial/netstd/Tutorial.sln create mode 100644 src/jaegertracing/thrift/tutorial/netstd/build.cmd create mode 100644 src/jaegertracing/thrift/tutorial/netstd/build.sh (limited to 'src/jaegertracing/thrift/tutorial/netstd') diff --git a/src/jaegertracing/thrift/tutorial/netstd/.gitignore b/src/jaegertracing/thrift/tutorial/netstd/.gitignore new file mode 100644 index 000000000..9938bb237 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/.gitignore @@ -0,0 +1 @@ +!**/*.pfx \ No newline at end of file diff --git a/src/jaegertracing/thrift/tutorial/netstd/Client/Client.csproj b/src/jaegertracing/thrift/tutorial/netstd/Client/Client.csproj new file mode 100644 index 000000000..a1470a9d3 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Client/Client.csproj @@ -0,0 +1,41 @@ + + + + + netcoreapp2.0 + Client + Client + Exe + false + false + false + false + + + + + + + + + + + + diff --git a/src/jaegertracing/thrift/tutorial/netstd/Client/Program.cs b/src/jaegertracing/thrift/tutorial/netstd/Client/Program.cs new file mode 100644 index 000000000..f9509fa2d --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Client/Program.cs @@ -0,0 +1,409 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Thrift; +using Thrift.Protocol; +using Thrift.Transport; +using Thrift.Transport.Client; +using tutorial; +using shared; +using Microsoft.Extensions.DependencyInjection; +using System.Diagnostics; + +namespace Client +{ + public class Program + { + private static ServiceCollection ServiceCollection = new ServiceCollection(); + private static ILogger Logger; + + private static void DisplayHelp() + { + Logger.LogInformation(@" +Usage: + Client.exe -help + will diplay help information + + Client.exe -tr: -bf: -pr: -mc: + will run client with specified arguments (tcp transport and binary protocol by default) and with 1 client + +Options: + -tr (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (address - ""http://localhost:9090"") + tcptls - tcp tls transport will be used (host - ""localhost"", port - 9090) + + -bf (buffering): + none - (default) no buffering will be used + buffered - buffered transport will be used + framed - framed transport will be used + + -pr (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + multiplexed - multiplexed protocol will be used + + -mc (multiple clients): + - number of multiple clients to connect to server (max 100, default 1) + +Sample: + Client.exe -tr:tcp -p:binary +"); + } + + public static void Main(string[] args) + { + args = args ?? new string[0]; + + ServiceCollection.AddLogging(logging => ConfigureLogging(logging)); + Logger = ServiceCollection.BuildServiceProvider().GetService().CreateLogger(nameof(Client)); + + if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase))) + { + DisplayHelp(); + return; + } + + Logger.LogInformation("Starting client..."); + + using (var source = new CancellationTokenSource()) + { + RunAsync(args, source.Token).GetAwaiter().GetResult(); + } + } + + private static void ConfigureLogging(ILoggingBuilder logging) + { + logging.SetMinimumLevel(LogLevel.Trace); + logging.AddConsole(); + logging.AddDebug(); + } + + private static async Task RunAsync(string[] args, CancellationToken cancellationToken) + { + var numClients = GetNumberOfClients(args); + + Logger.LogInformation($"Selected # of clients: {numClients}"); + + var transports = new TTransport[numClients]; + for (int i = 0; i < numClients; i++) + { + var t = GetTransport(args); + transports[i] = t; + } + + Logger.LogInformation($"Selected client transport: {transports[0]}"); + + var protocols = new Tuple[numClients]; + for (int i = 0; i < numClients; i++) + { + var p = GetProtocol(args, transports[i]); + protocols[i] = p; + } + + Logger.LogInformation($"Selected client protocol: {protocols[0].Item1}"); + + var tasks = new Task[numClients]; + for (int i = 0; i < numClients; i++) + { + var task = RunClientAsync(protocols[i], cancellationToken); + tasks[i] = task; + } + + Task.WaitAll(tasks); + + await Task.CompletedTask; + } + + private static TTransport GetTransport(string[] args) + { + TTransport transport = new TSocketTransport(IPAddress.Loopback, 9090); + + // construct endpoint transport + var transportArg = args.FirstOrDefault(x => x.StartsWith("-tr"))?.Split(':')?[1]; + if (Enum.TryParse(transportArg, true, out Transport selectedTransport)) + { + switch (selectedTransport) + { + case Transport.Tcp: + transport = new TSocketTransport(IPAddress.Loopback, 9090); + break; + + case Transport.NamedPipe: + transport = new TNamedPipeTransport(".test"); + break; + + case Transport.Http: + transport = new THttpTransport(new Uri("http://localhost:9090"), null); + break; + + case Transport.TcpTls: + transport = new TTlsSocketTransport(IPAddress.Loopback, 9090, GetCertificate(), CertValidator, LocalCertificateSelectionCallback); + break; + + default: + Debug.Assert(false, "unhandled case"); + break; + } + } + + // optionally add layered transport(s) + var bufferingArg = args.FirstOrDefault(x => x.StartsWith("-bf"))?.Split(':')?[1]; + if (Enum.TryParse(bufferingArg, out var selectedBuffering)) + { + switch (selectedBuffering) + { + case Buffering.Buffered: + transport = new TBufferedTransport(transport); + break; + + case Buffering.Framed: + transport = new TFramedTransport(transport); + break; + + default: // layered transport(s) are optional + Debug.Assert(selectedBuffering == Buffering.None, "unhandled case"); + break; + } + } + + return transport; + } + + private static int GetNumberOfClients(string[] args) + { + var numClients = args.FirstOrDefault(x => x.StartsWith("-mc"))?.Split(':')?[1]; + + Logger.LogInformation($"Selected # of clients: {numClients}"); + + int c; + if( int.TryParse(numClients, out c) && (0 < c) && (c <= 100)) + return c; + else + return 1; + } + + private static X509Certificate2 GetCertificate() + { + // due to files location in net core better to take certs from top folder + var certFile = GetCertPath(Directory.GetParent(Directory.GetCurrentDirectory())); + return new X509Certificate2(certFile, "ThriftTest"); + } + + private static string GetCertPath(DirectoryInfo di, int maxCount = 6) + { + var topDir = di; + var certFile = + topDir.EnumerateFiles("ThriftTest.pfx", SearchOption.AllDirectories) + .FirstOrDefault(); + if (certFile == null) + { + if (maxCount == 0) + throw new FileNotFoundException("Cannot find file in directories"); + return GetCertPath(di.Parent, maxCount - 1); + } + + return certFile.FullName; + } + + private static X509Certificate LocalCertificateSelectionCallback(object sender, + string targetHost, X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, string[] acceptableIssuers) + { + return GetCertificate(); + } + + private static bool CertValidator(object sender, X509Certificate certificate, + X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + return true; + } + + private static Tuple GetProtocol(string[] args, TTransport transport) + { + var protocol = args.FirstOrDefault(x => x.StartsWith("-pr"))?.Split(':')?[1]; + + Protocol selectedProtocol; + if (Enum.TryParse(protocol, true, out selectedProtocol)) + { + switch (selectedProtocol) + { + case Protocol.Binary: + return new Tuple(selectedProtocol, new TBinaryProtocol(transport)); + case Protocol.Compact: + return new Tuple(selectedProtocol, new TCompactProtocol(transport)); + case Protocol.Json: + return new Tuple(selectedProtocol, new TJsonProtocol(transport)); + case Protocol.Multiplexed: + // it returns BinaryProtocol to avoid making wrapped protocol as public in TProtocolDecorator (in RunClientAsync it will be wrapped into Multiplexed protocol) + return new Tuple(selectedProtocol, new TBinaryProtocol(transport)); + default: + Debug.Assert(false, "unhandled case"); + break; + } + } + + return new Tuple(selectedProtocol, new TBinaryProtocol(transport)); + } + + private static async Task RunClientAsync(Tuple protocolTuple, CancellationToken cancellationToken) + { + try + { + var protocol = protocolTuple.Item2; + var protocolType = protocolTuple.Item1; + + TBaseClient client = null; + + try + { + if (protocolType != Protocol.Multiplexed) + { + + client = new Calculator.Client(protocol); + await ExecuteCalculatorClientOperations(cancellationToken, (Calculator.Client)client); + } + else + { + // it uses binary protocol there to create Multiplexed protocols + var multiplex = new TMultiplexedProtocol(protocol, nameof(Calculator)); + client = new Calculator.Client(multiplex); + await ExecuteCalculatorClientOperations(cancellationToken, (Calculator.Client)client); + + multiplex = new TMultiplexedProtocol(protocol, nameof(SharedService)); + client = new SharedService.Client(multiplex); + await ExecuteSharedServiceClientOperations(cancellationToken, (SharedService.Client)client); + } + } + catch (Exception ex) + { + Logger.LogError($"{client?.ClientId} " + ex); + } + finally + { + protocol.Transport.Close(); + } + } + catch (TApplicationException x) + { + Logger.LogError(x.ToString()); + } + } + + private static async Task ExecuteCalculatorClientOperations(CancellationToken cancellationToken, Calculator.Client client) + { + await client.OpenTransportAsync(cancellationToken); + + // Async version + + Logger.LogInformation($"{client.ClientId} PingAsync()"); + await client.pingAsync(cancellationToken); + + Logger.LogInformation($"{client.ClientId} AddAsync(1,1)"); + var sum = await client.addAsync(1, 1, cancellationToken); + Logger.LogInformation($"{client.ClientId} AddAsync(1,1)={sum}"); + + var work = new Work + { + Op = Operation.DIVIDE, + Num1 = 1, + Num2 = 0 + }; + + try + { + Logger.LogInformation($"{client.ClientId} CalculateAsync(1)"); + await client.calculateAsync(1, work, cancellationToken); + Logger.LogInformation($"{client.ClientId} Whoa we can divide by 0"); + } + catch (InvalidOperation io) + { + Logger.LogInformation($"{client.ClientId} Invalid operation: " + io); + } + + work.Op = Operation.SUBTRACT; + work.Num1 = 15; + work.Num2 = 10; + + try + { + Logger.LogInformation($"{client.ClientId} CalculateAsync(1)"); + var diff = await client.calculateAsync(1, work, cancellationToken); + Logger.LogInformation($"{client.ClientId} 15-10={diff}"); + } + catch (InvalidOperation io) + { + Logger.LogInformation($"{client.ClientId} Invalid operation: " + io); + } + + Logger.LogInformation($"{client.ClientId} GetStructAsync(1)"); + var log = await client.getStructAsync(1, cancellationToken); + Logger.LogInformation($"{client.ClientId} Check log: {log.Value}"); + + Logger.LogInformation($"{client.ClientId} ZipAsync() with delay 100mc on server side"); + await client.zipAsync(cancellationToken); + } + private static async Task ExecuteSharedServiceClientOperations(CancellationToken cancellationToken, SharedService.Client client) + { + await client.OpenTransportAsync(cancellationToken); + + // Async version + + Logger.LogInformation($"{client.ClientId} SharedService GetStructAsync(1)"); + var log = await client.getStructAsync(1, cancellationToken); + Logger.LogInformation($"{client.ClientId} SharedService Value: {log.Value}"); + } + + + private enum Transport + { + Tcp, + NamedPipe, + Http, + TcpBuffered, + Framed, + TcpTls + } + + private enum Protocol + { + Binary, + Compact, + Json, + Multiplexed + } + + private enum Buffering + { + None, + Buffered, + Framed + } + } +} diff --git a/src/jaegertracing/thrift/tutorial/netstd/Client/Properties/AssemblyInfo.cs b/src/jaegertracing/thrift/tutorial/netstd/Client/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..568382e66 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Client/Properties/AssemblyInfo.cs @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("de78a01b-f7c6-49d1-97da-669d2ed37641")] \ No newline at end of file diff --git a/src/jaegertracing/thrift/tutorial/netstd/Client/Properties/launchSettings.json b/src/jaegertracing/thrift/tutorial/netstd/Client/Properties/launchSettings.json new file mode 100644 index 000000000..6b7b60d78 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Client/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Client": { + "commandName": "Project", + "commandLineArgs": "-p:multiplexed" + } + } +} \ No newline at end of file diff --git a/src/jaegertracing/thrift/tutorial/netstd/Client/ThriftTest.pfx b/src/jaegertracing/thrift/tutorial/netstd/Client/ThriftTest.pfx new file mode 100644 index 000000000..f0ded2817 Binary files /dev/null and b/src/jaegertracing/thrift/tutorial/netstd/Client/ThriftTest.pfx differ diff --git a/src/jaegertracing/thrift/tutorial/netstd/Interfaces/.gitignore b/src/jaegertracing/thrift/tutorial/netstd/Interfaces/.gitignore new file mode 100644 index 000000000..2e7446e33 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Interfaces/.gitignore @@ -0,0 +1,3 @@ +# ignore for autogenerated files +/shared +/tutorial diff --git a/src/jaegertracing/thrift/tutorial/netstd/Interfaces/Interfaces.csproj b/src/jaegertracing/thrift/tutorial/netstd/Interfaces/Interfaces.csproj new file mode 100644 index 000000000..4ebeb4f42 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Interfaces/Interfaces.csproj @@ -0,0 +1,48 @@ + + + + + netstandard2.0 + Interfaces + Interfaces + false + false + false + false + + + + + + + + + + + + + + + + + + + + diff --git a/src/jaegertracing/thrift/tutorial/netstd/Interfaces/Properties/AssemblyInfo.cs b/src/jaegertracing/thrift/tutorial/netstd/Interfaces/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..9126b173e --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Interfaces/Properties/AssemblyInfo.cs @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("4d13163d-9067-4c9c-8af0-64e08451397d")] \ No newline at end of file diff --git a/src/jaegertracing/thrift/tutorial/netstd/Makefile.am b/src/jaegertracing/thrift/tutorial/netstd/Makefile.am new file mode 100644 index 000000000..e30555655 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Makefile.am @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +SUBDIRS = . + +all-local: + $(DOTNETCORE) build + +clean-local: + $(RM) Interfaces.dll + $(RM) -r Client/bin + $(RM) -r Client/obj + $(RM) -r Server/bin + $(RM) -r Server/obj + $(RM) -r Interfaces/bin + $(RM) -r Interfaces/obj + +EXTRA_DIST = \ + Client \ + Interfaces \ + README.md \ + Server \ + Tutorial.sln \ + build.cmd \ + build.sh + diff --git a/src/jaegertracing/thrift/tutorial/netstd/README.md b/src/jaegertracing/thrift/tutorial/netstd/README.md new file mode 100644 index 000000000..b1dea4ecb --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/README.md @@ -0,0 +1,284 @@ +# Building of samples for different platforms + +# Reused components +- NET Core Standard 2.0 +- NET Core App 2.0 + +# How to build +- Download and install the latest .NET Core SDK for your platform https://www.microsoft.com/net/core#windowsvs2015 (archive for SDK 1.0.0-preview2-003121 located by: https://github.com/dotnet/core/blob/master/release-notes/download-archive.md) +- Ensure that you have thrift.exe which supports netstd lib and it added to PATH +- Go to current folder +- Run **build.sh** or **build.cmd** from the root of cloned repository +- Check tests in **src/Tests** folder +- Continue with /tutorials/netstd + +# How to run + +Notes: dotnet run supports passing arguments to app after -- symbols (https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-run) - example: **dotnet run -- -h** will show help for app + +- build +- go to folder (Client/Server) +- run with specifying of correct parameters **dotnet run -tr:tcp -pr:multiplexed**, **dotnet run -help** (later, after migration to csproj and latest SDK will be possibility to use more usable form **dotnet run -- arguments**) + +#Notes +- Possible adding additional platforms after stabilization of .NET Core (runtimes, platforms (Red Hat Linux, OpenSuse, etc.) + +#Known issues +- In trace logging mode you can see some not important internal exceptions + +# Running of samples +Please install Thrift C# .NET Core library or copy sources and build them to correcly build and run samples + +# NetCore Server + +Usage: + + Server.exe -h + will diplay help information + + Server.exe -tr: -pr: + will run server with specified arguments (tcp transport and binary protocol by default) + +Options: + + -tr (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (http address - ""localhost:9090"") + tcptls - tcp transport with tls will be used (host - ""localhost"", port - 9090) + + -bf (buffering): + none - (default) no transport factory will be used + buffered - buffered transport factory will be used + framed - framed transport factory will be used (this must match the client) + + -pr (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + +Sample: + + Server.exe -tr:tcp + +**Remarks**: + + For TcpTls mode certificate's file ThriftTest.pfx should be in directory with binaries in case of command line usage (or at project level in case of debugging from IDE). + Password for certificate - "ThriftTest". + + + +# NetCore Client + +Usage: + + Client.exe -h + will diplay help information + + Client.exe -tr: -pr: -mc: + will run client with specified arguments (tcp transport and binary protocol by default) + +Options: + + -tr (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (address - ""http://localhost:9090"") + tcptls - tcp tls transport will be used (host - ""localhost"", port - 9090) + + -bf (buffering): + none - (default) no transport factory will be used + buffered - buffered transport factory will be used + framed - framed transport factory will be used (this must match the client) + + -pr (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + + -mc (multiple clients): + - number of multiple clients to connect to server (max 100, default 1) + +Sample: + + Client.exe -tr:tcp -pr:binary -mc:10 + +Remarks: + + For TcpTls mode certificate's file ThriftTest.pfx should be in directory + with binaries in case of command line usage (or at project level in case of debugging from IDE). + Password for certificate - "ThriftTest". + +# How to test communication between NetCore and Python + +* Generate code with the latest **thrift.exe** util +* Ensure that **thrift.exe** util generated folder **gen-py** with generated code for Python +* Create **client.py** and **server.py** from the code examples below and save them to the folder with previosly generated folder **gen-py** +* Run netstd samples (client and server) and python samples (client and server) + +Remarks: + +Samples of client and server code below use correct methods (operations) +and fields (properties) according to generated contracts from *.thrift files + +At Windows 10 add record **127.0.0.1 testserver** to **C:\Windows\System32\drivers\etc\hosts** file +for correct work of python server + + +**Python Client:** + +```python +import sys +import glob +sys.path.append('gen-py') + +from tutorial import Calculator +from tutorial.ttypes import InvalidOperation, Operation, Work + +from thrift import Thrift +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol + + +def main(): + # Make socket + transport = TSocket.TSocket('127.0.0.1', 9090) + + # Buffering is critical. Raw sockets are very slow + transport = TTransport.TBufferedTransport(transport) + + # Wrap in a protocol + protocol = TBinaryProtocol.TBinaryProtocol(transport) + + # Create a client to use the protocol encoder + client = Calculator.Client(protocol) + + # Connect! + transport.open() + + client.Ping() + print('ping()') + + sum = client.Add(1, 1) + print(('1+1=%d' % (sum))) + + work = Work() + + work.Op = Operation.Divide + work.Num1 = 1 + work.Num2 = 0 + + try: + quotient = client.Calculate(1, work) + print('Whoa? You know how to divide by zero?') + print('FYI the answer is %d' % quotient) + except InvalidOperation as e: + print(('InvalidOperation: %r' % e)) + + work.Op = Operation.Substract + work.Num1 = 15 + work.Num2 = 10 + + diff = client.Calculate(1, work) + print(('15-10=%d' % (diff))) + + log = client.GetStruct(1) + print(('Check log: %s' % (log.Value))) + + client.Zip() + print('zip()') + + # Close! + transport.close() + +if __name__ == '__main__': + try: + main() + except Thrift.TException as tx: + print('%s' % tx.message) +``` + + +**Python Server:** + + +```python +import glob +import sys +sys.path.append('gen-py') + +from tutorial import Calculator +from tutorial.ttypes import InvalidOperation, Operation + +from shared.ttypes import SharedStruct + +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol +from thrift.server import TServer + + +class CalculatorHandler: + def __init__(self): + self.log = {} + + def Ping(self): + print('ping()') + + def Add(self, n1, n2): + print('add(%d,%d)' % (n1, n2)) + return n1 + n2 + + def Calculate(self, logid, work): + print('calculate(%d, %r)' % (logid, work)) + + if work.Op == Operation.Add: + val = work.Num1 + work.Num2 + elif work.Op == Operation.Substract: + val = work.Num1 - work.Num2 + elif work.Op == Operation.Multiply: + val = work.Num1 * work.Num2 + elif work.Op == Operation.Divide: + if work.Num2 == 0: + x = InvalidOperation() + x.WhatOp = work.Op + x.Why = 'Cannot divide by 0' + raise x + val = work.Num1 / work.Num2 + else: + x = InvalidOperation() + x.WhatOp = work.Op + x.Why = 'Invalid operation' + raise x + + log = SharedStruct() + log.Key = logid + log.Value = '%d' % (val) + self.log[logid] = log + + return val + + def GetStruct(self, key): + print('getStruct(%d)' % (key)) + return self.log[key] + + def Zip(self): + print('zip()') + +if __name__ == '__main__': + handler = CalculatorHandler() + processor = Calculator.Processor(handler) + transport = TSocket.TServerSocket(host="testserver", port=9090) + tfactory = TTransport.TBufferedTransportFactory() + pfactory = TBinaryProtocol.TBinaryProtocolFactory() + + server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) + print('Starting the server...') + server.serve() + print('done.') + + # You could do one of these for a multithreaded server + # server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) + # server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory) +``` diff --git a/src/jaegertracing/thrift/tutorial/netstd/Server/Program.cs b/src/jaegertracing/thrift/tutorial/netstd/Server/Program.cs new file mode 100644 index 000000000..25e7daeed --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Server/Program.cs @@ -0,0 +1,479 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Thrift; +using Thrift.Protocol; +using Thrift.Server; +using Thrift.Transport; +using Thrift.Transport.Server; +using tutorial; +using shared; +using Thrift.Processor; +using System.Diagnostics; + +namespace Server +{ + public class Program + { + private static ServiceCollection ServiceCollection = new ServiceCollection(); + private static ILogger Logger; + + public static void Main(string[] args) + { + args = args ?? new string[0]; + + ServiceCollection.AddLogging(logging => ConfigureLogging(logging)); + Logger = ServiceCollection.BuildServiceProvider().GetService().CreateLogger(nameof(Server)); + + + if (args.Any(x => x.StartsWith("-help", StringComparison.OrdinalIgnoreCase))) + { + DisplayHelp(); + return; + } + + using (var source = new CancellationTokenSource()) + { + RunAsync(args, source.Token).GetAwaiter().GetResult(); + + Logger.LogInformation("Press any key to stop..."); + + Console.ReadLine(); + source.Cancel(); + } + + Logger.LogInformation("Server stopped"); + } + + private static void ConfigureLogging(ILoggingBuilder logging) + { + logging.SetMinimumLevel(LogLevel.Trace); + logging.AddConsole(); + logging.AddDebug(); + } + + private static void DisplayHelp() + { + Logger.LogInformation(@" +Usage: + Server.exe -help + will diplay help information + + Server.exe -tr: -bf: -pr: + will run server with specified arguments (tcp transport, no buffering, and binary protocol by default) + +Options: + -tr (transport): + tcp - (default) tcp transport will be used (host - ""localhost"", port - 9090) + namedpipe - namedpipe transport will be used (pipe address - "".test"") + http - http transport will be used (http address - ""localhost:9090"") + tcptls - tcp transport with tls will be used (host - ""localhost"", port - 9090) + + -bf (buffering): + none - (default) no buffering will be used + buffered - buffered transport will be used + framed - framed transport will be used + + -pr (protocol): + binary - (default) binary protocol will be used + compact - compact protocol will be used + json - json protocol will be used + multiplexed - multiplexed protocol will be used + +Sample: + Server.exe -tr:tcp +"); + } + + private static async Task RunAsync(string[] args, CancellationToken cancellationToken) + { + var selectedTransport = GetTransport(args); + var selectedBuffering = GetBuffering(args); + var selectedProtocol = GetProtocol(args); + + if (selectedTransport == Transport.Http) + { + new HttpServerSample().Run(cancellationToken); + } + else + { + await RunSelectedConfigurationAsync(selectedTransport, selectedBuffering, selectedProtocol, cancellationToken); + } + } + + private static Protocol GetProtocol(string[] args) + { + var transport = args.FirstOrDefault(x => x.StartsWith("-pr"))?.Split(':')?[1]; + + Enum.TryParse(transport, true, out Protocol selectedProtocol); + + return selectedProtocol; + } + + private static Buffering GetBuffering(string[] args) + { + var buffering = args.FirstOrDefault(x => x.StartsWith("-bf"))?.Split(":")?[1]; + + Enum.TryParse(buffering, out var selectedBuffering); + + return selectedBuffering; + } + + private static Transport GetTransport(string[] args) + { + var transport = args.FirstOrDefault(x => x.StartsWith("-tr"))?.Split(':')?[1]; + + Enum.TryParse(transport, true, out Transport selectedTransport); + + return selectedTransport; + } + + private static async Task RunSelectedConfigurationAsync(Transport transport, Buffering buffering, Protocol protocol, CancellationToken cancellationToken) + { + var handler = new CalculatorAsyncHandler(); + + TServerTransport serverTransport = null; + switch (transport) + { + case Transport.Tcp: + serverTransport = new TServerSocketTransport(9090); + break; + case Transport.NamedPipe: + serverTransport = new TNamedPipeServerTransport(".test"); + break; + case Transport.TcpTls: + serverTransport = new TTlsServerSocketTransport(9090, GetCertificate(), ClientCertValidator, LocalCertificateSelectionCallback); + break; + } + + TTransportFactory inputTransportFactory = null; + TTransportFactory outputTransportFactory = null; + switch (buffering) + { + case Buffering.Buffered: + inputTransportFactory = new TBufferedTransport.Factory(); + outputTransportFactory = new TBufferedTransport.Factory(); + break; + + case Buffering.Framed: + inputTransportFactory = new TFramedTransport.Factory(); + outputTransportFactory = new TFramedTransport.Factory(); + break; + + default: // layered transport(s) are optional + Debug.Assert(buffering == Buffering.None, "unhandled case"); + break; + } + + TProtocolFactory inputProtocolFactory = null; + TProtocolFactory outputProtocolFactory = null; + ITAsyncProcessor processor = null; + switch (protocol) + { + case Protocol.Binary: + inputProtocolFactory = new TBinaryProtocol.Factory(); + outputProtocolFactory = new TBinaryProtocol.Factory(); + processor = new Calculator.AsyncProcessor(handler); + break; + + case Protocol.Compact: + inputProtocolFactory = new TCompactProtocol.Factory(); + outputProtocolFactory = new TCompactProtocol.Factory(); + processor = new Calculator.AsyncProcessor(handler); + break; + + case Protocol.Json: + inputProtocolFactory = new TJsonProtocol.Factory(); + outputProtocolFactory = new TJsonProtocol.Factory(); + processor = new Calculator.AsyncProcessor(handler); + break; + + case Protocol.Multiplexed: + inputProtocolFactory = new TBinaryProtocol.Factory(); + outputProtocolFactory = new TBinaryProtocol.Factory(); + + var calcHandler = new CalculatorAsyncHandler(); + var calcProcessor = new Calculator.AsyncProcessor(calcHandler); + + var sharedServiceHandler = new SharedServiceAsyncHandler(); + var sharedServiceProcessor = new SharedService.AsyncProcessor(sharedServiceHandler); + + var multiplexedProcessor = new TMultiplexedProcessor(); + multiplexedProcessor.RegisterProcessor(nameof(Calculator), calcProcessor); + multiplexedProcessor.RegisterProcessor(nameof(SharedService), sharedServiceProcessor); + + processor = multiplexedProcessor; + break; + + default: + throw new ArgumentOutOfRangeException(nameof(protocol), protocol, null); + } + + + try + { + Logger.LogInformation( + $"Selected TAsyncServer with {serverTransport} transport, {processor} processor and {inputProtocolFactory} protocol factories"); + + var loggerFactory = ServiceCollection.BuildServiceProvider().GetService(); + + var server = new TSimpleAsyncServer( + itProcessorFactory: new TSingletonProcessorFactory(processor), + serverTransport: serverTransport, + inputTransportFactory: inputTransportFactory, + outputTransportFactory: outputTransportFactory, + inputProtocolFactory: inputProtocolFactory, + outputProtocolFactory: outputProtocolFactory, + logger: loggerFactory.CreateLogger()); + + Logger.LogInformation("Starting the server..."); + + await server.ServeAsync(cancellationToken); + } + catch (Exception x) + { + Logger.LogInformation(x.ToString()); + } + } + + private static X509Certificate2 GetCertificate() + { + // due to files location in net core better to take certs from top folder + var certFile = GetCertPath(Directory.GetParent(Directory.GetCurrentDirectory())); + return new X509Certificate2(certFile, "ThriftTest"); + } + + private static string GetCertPath(DirectoryInfo di, int maxCount = 6) + { + var topDir = di; + var certFile = + topDir.EnumerateFiles("ThriftTest.pfx", SearchOption.AllDirectories) + .FirstOrDefault(); + if (certFile == null) + { + if (maxCount == 0) + throw new FileNotFoundException("Cannot find file in directories"); + return GetCertPath(di.Parent, maxCount - 1); + } + + return certFile.FullName; + } + + private static X509Certificate LocalCertificateSelectionCallback(object sender, + string targetHost, X509CertificateCollection localCertificates, + X509Certificate remoteCertificate, string[] acceptableIssuers) + { + return GetCertificate(); + } + + private static bool ClientCertValidator(object sender, X509Certificate certificate, + X509Chain chain, SslPolicyErrors sslPolicyErrors) + { + return true; + } + + private enum Transport + { + Tcp, + NamedPipe, + Http, + TcpTls, + } + + private enum Buffering + { + None, + Buffered, + Framed, + } + + private enum Protocol + { + Binary, + Compact, + Json, + Multiplexed + } + + public class HttpServerSample + { + public void Run(CancellationToken cancellationToken) + { + var config = new ConfigurationBuilder() + .AddEnvironmentVariables(prefix: "ASPNETCORE_") + .Build(); + + var host = new WebHostBuilder() + .UseConfiguration(config) + .UseKestrel() + .UseUrls("http://localhost:9090") + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseStartup() + .ConfigureLogging((ctx,logging) => ConfigureLogging(logging)) + .Build(); + + Logger.LogTrace("test"); + Logger.LogCritical("test"); + host.RunAsync(cancellationToken).GetAwaiter().GetResult(); + } + + public class Startup + { + public Startup(IHostingEnvironment env) + { + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddEnvironmentVariables(); + + Configuration = builder.Build(); + } + + public IConfigurationRoot Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + { + app.UseMiddleware(); + } + } + } + + public class CalculatorAsyncHandler : Calculator.IAsync + { + private readonly Dictionary _log = new Dictionary(); + + public CalculatorAsyncHandler() + { + } + + public async Task getStructAsync(int key, + CancellationToken cancellationToken) + { + Logger.LogInformation("GetStructAsync({0})", key); + return await Task.FromResult(_log[key]); + } + + public async Task pingAsync(CancellationToken cancellationToken) + { + Logger.LogInformation("PingAsync()"); + await Task.CompletedTask; + } + + public async Task addAsync(int num1, int num2, CancellationToken cancellationToken) + { + Logger.LogInformation($"AddAsync({num1},{num2})"); + return await Task.FromResult(num1 + num2); + } + + public async Task calculateAsync(int logid, Work w, CancellationToken cancellationToken) + { + Logger.LogInformation($"CalculateAsync({logid}, [{w.Op},{w.Num1},{w.Num2}])"); + + var val = 0; + switch (w.Op) + { + case Operation.ADD: + val = w.Num1 + w.Num2; + break; + + case Operation.SUBTRACT: + val = w.Num1 - w.Num2; + break; + + case Operation.MULTIPLY: + val = w.Num1 * w.Num2; + break; + + case Operation.DIVIDE: + if (w.Num2 == 0) + { + var io = new InvalidOperation + { + WhatOp = (int) w.Op, + Why = "Cannot divide by 0" + }; + + throw io; + } + val = w.Num1 / w.Num2; + break; + + default: + { + var io = new InvalidOperation + { + WhatOp = (int) w.Op, + Why = "Unknown operation" + }; + + throw io; + } + } + + var entry = new SharedStruct + { + Key = logid, + Value = val.ToString() + }; + + _log[logid] = entry; + + return await Task.FromResult(val); + } + + public async Task zipAsync(CancellationToken cancellationToken) + { + Logger.LogInformation("ZipAsync() with delay 100mc"); + await Task.Delay(100, CancellationToken.None); + } + } + + public class SharedServiceAsyncHandler : SharedService.IAsync + { + public async Task getStructAsync(int key, CancellationToken cancellationToken) + { + Logger.LogInformation("GetStructAsync({0})", key); + return await Task.FromResult(new SharedStruct() + { + Key = key, + Value = "GetStructAsync" + }); + } + } + } +} diff --git a/src/jaegertracing/thrift/tutorial/netstd/Server/Properties/AssemblyInfo.cs b/src/jaegertracing/thrift/tutorial/netstd/Server/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..a0442350b --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Server/Properties/AssemblyInfo.cs @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation(ASF) under one +// or more contributor license agreements.See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership.The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("The Apache Software Foundation")] +[assembly: AssemblyProduct("Thrift")] +[assembly: AssemblyCopyright("The Apache Software Foundation")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. + +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM + +[assembly: Guid("e210fc10-5aff-4b04-ac21-58afc7b74b0c")] \ No newline at end of file diff --git a/src/jaegertracing/thrift/tutorial/netstd/Server/Properties/launchSettings.json b/src/jaegertracing/thrift/tutorial/netstd/Server/Properties/launchSettings.json new file mode 100644 index 000000000..78076ff7c --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Server/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Server": { + "commandName": "Project", + "commandLineArgs": "-p:multiplexed" + } + } +} \ No newline at end of file diff --git a/src/jaegertracing/thrift/tutorial/netstd/Server/Server.csproj b/src/jaegertracing/thrift/tutorial/netstd/Server/Server.csproj new file mode 100644 index 000000000..fbc2c0370 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Server/Server.csproj @@ -0,0 +1,44 @@ + + + + + netcoreapp2.0 + Server + Server + Exe + false + false + false + false + + + + + + + + + + + + + + + diff --git a/src/jaegertracing/thrift/tutorial/netstd/Server/ThriftTest.pfx b/src/jaegertracing/thrift/tutorial/netstd/Server/ThriftTest.pfx new file mode 100644 index 000000000..f0ded2817 Binary files /dev/null and b/src/jaegertracing/thrift/tutorial/netstd/Server/ThriftTest.pfx differ diff --git a/src/jaegertracing/thrift/tutorial/netstd/Tutorial.sln b/src/jaegertracing/thrift/tutorial/netstd/Tutorial.sln new file mode 100644 index 000000000..84b257902 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/Tutorial.sln @@ -0,0 +1,78 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26114.2 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Thrift", "..\..\lib\netstd\Thrift\Thrift.csproj", "{C20EA2A9-7660-47DE-9A49-D1EF12FB2895}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Interfaces", "Interfaces\Interfaces.csproj", "{B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client\Client.csproj", "{E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "Server\Server.csproj", "{E08F5B84-2B4A-4E09-82D1-E0715775CE5E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x64.ActiveCfg = Debug|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x64.Build.0 = Debug|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x86.ActiveCfg = Debug|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Debug|x86.Build.0 = Debug|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|Any CPU.Build.0 = Release|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x64.ActiveCfg = Release|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x64.Build.0 = Release|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x86.ActiveCfg = Release|Any CPU + {C20EA2A9-7660-47DE-9A49-D1EF12FB2895}.Release|x86.Build.0 = Release|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x64.Build.0 = Debug|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Debug|x86.Build.0 = Debug|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x64.ActiveCfg = Release|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x64.Build.0 = Release|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x86.ActiveCfg = Release|Any CPU + {B9E24D84-2712-4158-8F1A-DDE44CD1BB0A}.Release|x86.Build.0 = Release|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x64.ActiveCfg = Debug|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x64.Build.0 = Debug|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x86.ActiveCfg = Debug|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Debug|x86.Build.0 = Debug|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|Any CPU.Build.0 = Release|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x64.ActiveCfg = Release|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x64.Build.0 = Release|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x86.ActiveCfg = Release|Any CPU + {E4CA1EF0-B181-4A5D-A02C-DB0750A59CDF}.Release|x86.Build.0 = Release|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x64.ActiveCfg = Debug|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x64.Build.0 = Debug|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x86.ActiveCfg = Debug|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Debug|x86.Build.0 = Debug|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|Any CPU.Build.0 = Release|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x64.ActiveCfg = Release|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x64.Build.0 = Release|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x86.ActiveCfg = Release|Any CPU + {E08F5B84-2B4A-4E09-82D1-E0715775CE5E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {070A5D1D-B29D-4603-999D-693DB444AD0D} + EndGlobalSection +EndGlobal diff --git a/src/jaegertracing/thrift/tutorial/netstd/build.cmd b/src/jaegertracing/thrift/tutorial/netstd/build.cmd new file mode 100644 index 000000000..9b84ef276 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/build.cmd @@ -0,0 +1,25 @@ +@echo off +rem /* +rem * Licensed to the Apache Software Foundation (ASF) under one +rem * or more contributor license agreements. See the NOTICE file +rem * distributed with this work for additional information +rem * regarding copyright ownership. The ASF licenses this file +rem * to you under the Apache License, Version 2.0 (the +rem * "License"); you may not use this file except in compliance +rem * with the License. You may obtain a copy of the License at +rem * +rem * http://www.apache.org/licenses/LICENSE-2.0 +rem * +rem * Unless required by applicable law or agreed to in writing, +rem * software distributed under the License is distributed on an +rem * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +rem * KIND, either express or implied. See the License for the +rem * specific language governing permissions and limitations +rem * under the License. +rem */ +setlocal + +dotnet --info +dotnet build + +:eof diff --git a/src/jaegertracing/thrift/tutorial/netstd/build.sh b/src/jaegertracing/thrift/tutorial/netstd/build.sh new file mode 100644 index 000000000..c97e310f0 --- /dev/null +++ b/src/jaegertracing/thrift/tutorial/netstd/build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +#exit if any command fails +set -e + +dotnet --info +dotnet build -- cgit v1.2.3