Gaiato.Net.Network 1.0.14

dotnet add package Gaiato.Net.Network --version 1.0.14
                    
NuGet\Install-Package Gaiato.Net.Network -Version 1.0.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gaiato.Net.Network" Version="1.0.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gaiato.Net.Network" Version="1.0.14" />
                    
Directory.Packages.props
<PackageReference Include="Gaiato.Net.Network" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gaiato.Net.Network --version 1.0.14
                    
#r "nuget: Gaiato.Net.Network, 1.0.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gaiato.Net.Network@1.0.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gaiato.Net.Network&version=1.0.14
                    
Install as a Cake Addin
#tool nuget:?package=Gaiato.Net.Network&version=1.0.14
                    
Install as a Cake Tool

Gaiato.Net.Network

NuGet Build Status

Descrição

Gaiato.Net.Network é um pacote NuGet que fornece uma maneira simples e eficiente de consultar APIS públicas como por exemplo, para obter o endereço IP externo de uma máquina utilizando o ipify.

O pacote foi desenvolvido seguindo os princípios de Clean Code e SOLID, garantindo flexibilidade, testabilidade e manutenibilidade. É compatível com projetos .NET 7 ou superior.

Recursos

  • Obtenção do endereço IP externo com apenas uma chamada assíncrona.
  • Integração fácil com HttpClient e injeção de dependência.
  • Testado e validado com testes unitários.
  • Código otimizado para performance e confiabilidade.

Instalação

Para instalar o pacote, utilize o seguinte comando no terminal:

dotnet add package Gaiato.Net.Network

Ou adicione diretamente via o Gerenciador de Pacotes NuGet do Visual Studio, buscando por Gaiato.Net.Network.

Uso

Configuração no Startup ou Program.cs

Adicione o serviço ao contêiner de injeção de dependência utilizando o método de extensão incluído:

using Microsoft.Extensions.DependencyInjection;
using Gaiato.Net.Network;

var services = new ServiceCollection();
services.AddExternalIpService();

var serviceProvider = services.BuildServiceProvider();
var ipService = serviceProvider.GetRequiredService<IExternalIpService>();

var externalIp = await ipService.GetExternalIpAsync();
Console.WriteLine($"Seu IP externo é: {externalIp}");

Injeção em Serviços

Você também pode injetar o serviço diretamente em suas classes:

public class MyService
{
    private readonly IExternalIpService _externalIpService;

    public MyService(IExternalIpService externalIpService)
    {
        _externalIpService = externalIpService;
    }

    public async Task LogExternalIpAsync()
    {
        var ip = await _externalIpService.GetExternalIpAsync();
        Console.WriteLine($"Endereço IP externo: {ip}");
    }
}

Estrutura do Projeto

├── Gaiato.Net.Network/
│   ├── Gaiato.Net.Network.csproj
│   ├── ExternalIpService.cs
│   ├── IExternalIpService.cs
│   ├── ServiceCollectionExtensions.cs
├── .github/
│   └── workflows/
│       └── publish-nuget.yml
├── README.md

Contribuindo

Contribuições são bem-vindas! Sinta-se à vontade para ajudar com:

  • Reportar problemas ou sugerir melhorias na aba Issues.
  • Fazer um fork do repositório e enviar pull requests.
  • Melhorar a documentação ou adicionar novos testes.

Passo a Passo para Contribuir

  1. Faça um fork do repositório.
  2. Crie uma nova branch para sua funcionalidade ou correção:
    git checkout -b minha-nova-funcionalidade
    
  3. Faça suas alterações e commit:
    git commit -m "Adicionei minha nova funcionalidade"
    
  4. Envie para sua branch:
    git push origin minha-nova-funcionalidade
    
  5. Abra um pull request no GitHub.

Licença

Este projeto está licenciado sob a licença MIT. Consulte o arquivo LICENSE para mais detalhes.

Referências


Status do Build

O processo de publicação é automatizado utilizando GitHub Actions. Ao enviar um commit para a branch main ou criar uma tag no formato v1.0.0, o pacote será automaticamente publicado no NuGet.

Projeto Gaiato.Net

#SejaGaiato

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.14 154 12/16/2024
1.0.11 131 12/15/2024
1.0.9 127 12/15/2024
1.0.4 127 12/15/2024
1.0.3 121 12/15/2024
1.0.2 123 12/15/2024