Skip to content

Release main/Smdn.Net.MuninNode-2.2.0 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 138 additions & 7 deletions doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net8.0.apilist.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-2.1.0)
// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-2.2.0)
// Name: Smdn.Net.MuninNode
// AssemblyVersion: 2.1.0.0
// InformationalVersion: 2.1.0+16b4425cbed9d9331220cdef22e4c3e669122124
// AssemblyVersion: 2.2.0.0
// InformationalVersion: 2.2.0+04e5ff38096e4d62b2c9bc5a716d8b2c5a6ad72d
// TargetFramework: .NETCoreApp,Version=v8.0
// Configuration: Release
// Referenced assemblies:
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Microsoft.Extensions.Options, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
// Smdn.Fundamental.Exception, Version=3.0.0.0, Culture=neutral
// System.Collections, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Expand All @@ -21,7 +22,9 @@
#nullable enable annotations

using System;
using System.Buffers;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Sockets;
using System.Text;
Expand All @@ -30,53 +33,167 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Smdn.Net.MuninNode;
using Smdn.Net.MuninNode.DependencyInjection;
using Smdn.Net.MuninNode.Transport;
using Smdn.Net.MuninPlugin;

namespace Smdn.Net.MuninNode {
public interface IAccessRule {
bool IsAcceptable(IPEndPoint remoteEndPoint);
}

public interface IMuninNode {
EndPoint EndPoint { get; }
string HostName { get; }

Task RunAsync(CancellationToken cancellationToken);
}

public static class IAccessRuleServiceCollectionExtensions {
public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IAccessRule accessRule) {}
public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IReadOnlyList<IPAddress> addressListAllowFrom) {}
public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IReadOnlyList<IPAddress> addressListAllowFrom, bool shouldConsiderIPv4MappedIPv6Address) {}
public static IServiceCollection AddMuninNodeLoopbackOnlyAccessRule(this IServiceCollection services) {}
}

public abstract class LocalNode : NodeBase {
public static LocalNode Create(IPluginProvider pluginProvider, int port, string? hostName = null, IReadOnlyList<IPAddress>? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {}
public static LocalNode Create(IReadOnlyCollection<IPlugin> plugins, int port, string? hostName = null, IReadOnlyList<IPAddress>? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {}

[Obsolete("Use a constructor overload that takes IMuninNodeListenerFactory as an argument.")]
protected LocalNode(IAccessRule? accessRule, ILogger? logger = null) {}
protected LocalNode(IMuninNodeListenerFactory? listenerFactory, IAccessRule? accessRule, ILogger? logger) {}

[Obsolete("Use IMuninNodeListenerFactory and StartAsync instead.")]
protected override Socket CreateServerSocket() {}
protected virtual EndPoint GetLocalEndPointToBind() {}
}

public sealed class MuninNodeOptions {
public const string DefaultHostName = "munin-node.localhost";
public const int DefaultPort = 4949;

public static IPAddress DefaultAddress { get; }

public MuninNodeOptions() {}

public IAccessRule? AccessRule { get; set; }
public IPAddress Address { get; set; }
public string HostName { get; set; }
public int Port { get; set; }

public MuninNodeOptions AllowFrom(IReadOnlyList<IPAddress> addresses, bool shouldConsiderIPv4MappedIPv6Address = true) {}
public MuninNodeOptions AllowFromLoopbackOnly() {}
public MuninNodeOptions UseAnyAddress() {}
public MuninNodeOptions UseAnyAddress(int port) {}
public MuninNodeOptions UseLoopbackAddress() {}
public MuninNodeOptions UseLoopbackAddress(int port) {}
}

public abstract class NodeBase :
IAsyncDisposable,
IDisposable
IDisposable,
IMuninNode
{
[Obsolete("Use a constructor overload that takes IMuninNodeListenerFactory as an argument.")]
protected NodeBase(IAccessRule? accessRule, ILogger? logger) {}
protected NodeBase(IMuninNodeListenerFactory listenerFactory, IAccessRule? accessRule, ILogger? logger) {}

public virtual Encoding Encoding { get; }
public EndPoint EndPoint { get; }
public abstract string HostName { get; }
protected IMuninNodeListener? Listener { get; }
[Obsolete("Use EndPoint instead.")]
public EndPoint LocalEndPoint { get; }
protected ILogger? Logger { get; }
public virtual Version NodeVersion { get; }
public abstract IPluginProvider PluginProvider { get; }

public async ValueTask AcceptAsync(bool throwIfCancellationRequested, CancellationToken cancellationToken) {}
public async ValueTask AcceptSingleSessionAsync(CancellationToken cancellationToken = default) {}
protected abstract Socket CreateServerSocket();
[Obsolete("Use IMuninNodeListenerFactory and StartAsync instead.")]
protected virtual Socket CreateServerSocket() {}
protected virtual void Dispose(bool disposing) {}
public void Dispose() {}
public async ValueTask DisposeAsync() {}
protected virtual async ValueTask DisposeAsyncCore() {}
protected virtual EndPoint GetLocalEndPointToBind() {}
public Task RunAsync(CancellationToken cancellationToken) {}
[Obsolete("This method will be deprecated in the future.Use IMuninNodeListenerFactory and StartAsync instead.Make sure to override CreateServerSocket if you need to use this method.")]
public void Start() {}
public ValueTask StartAsync(CancellationToken cancellationToken = default) {}
protected void ThrowIfDisposed() {}
protected void ThrowIfPluginProviderIsNull() {}
}
}

namespace Smdn.Net.MuninNode.DependencyInjection {
public interface IMuninNodeBuilder {
string ServiceKey { get; }
IServiceCollection Services { get; }

IMuninNode Build(IServiceProvider serviceProvider);
}

public interface IMuninServiceBuilder {
IServiceCollection Services { get; }
}

public static class IMuninNodeBuilderExtensions {
public static IMuninNodeBuilder AddPlugin(this IMuninNodeBuilder builder, Func<IServiceProvider, IPlugin> buildPlugin) {}
public static IMuninNodeBuilder AddPlugin(this IMuninNodeBuilder builder, IPlugin plugin) {}
public static IMuninNodeBuilder UseListenerFactory(this IMuninNodeBuilder builder, Func<IServiceProvider, EndPoint, IMuninNode, CancellationToken, ValueTask<IMuninNodeListener>> createListenerAsyncFunc) {}
public static IMuninNodeBuilder UseListenerFactory(this IMuninNodeBuilder builder, Func<IServiceProvider, IMuninNodeListenerFactory> buildListenerFactory) {}
public static IMuninNodeBuilder UseListenerFactory(this IMuninNodeBuilder builder, IMuninNodeListenerFactory listenerFactory) {}
public static IMuninNodeBuilder UsePluginProvider(this IMuninNodeBuilder builder, Func<IServiceProvider, IPluginProvider> buildPluginProvider) {}
public static IMuninNodeBuilder UsePluginProvider(this IMuninNodeBuilder builder, IPluginProvider pluginProvider) {}
public static IMuninNodeBuilder UseSessionCallback(this IMuninNodeBuilder builder, Func<IServiceProvider, INodeSessionCallback> buildSessionCallback) {}
public static IMuninNodeBuilder UseSessionCallback(this IMuninNodeBuilder builder, Func<string, CancellationToken, ValueTask>? reportSessionStartedAsyncFunc, Func<string, CancellationToken, ValueTask>? reportSessionClosedAsyncFunc) {}
public static IMuninNodeBuilder UseSessionCallback(this IMuninNodeBuilder builder, INodeSessionCallback sessionCallback) {}
}

public static class IMuninServiceBuilderExtensions {
public static IMuninNodeBuilder AddNode(this IMuninServiceBuilder builder) {}
public static IMuninNodeBuilder AddNode(this IMuninServiceBuilder builder, Action<MuninNodeOptions> configure) {}
}

public static class IServiceCollectionExtensions {
public static IServiceCollection AddMunin(this IServiceCollection services, Action<IMuninServiceBuilder> configure) {}
}
}

namespace Smdn.Net.MuninNode.Transport {
public interface IMuninNodeClient :
IAsyncDisposable,
IDisposable
{
EndPoint? EndPoint { get; }

ValueTask DisconnectAsync(CancellationToken cancellationToken);
ValueTask<int> ReceiveAsync(IBufferWriter<byte> buffer, CancellationToken cancellationToken);
ValueTask SendAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken);
}

public interface IMuninNodeListener :
IAsyncDisposable,
IDisposable
{
EndPoint? EndPoint { get; }

ValueTask<IMuninNodeClient> AcceptAsync(CancellationToken cancellationToken);
ValueTask StartAsync(CancellationToken cancellationToken);
}

public interface IMuninNodeListenerFactory {
ValueTask<IMuninNodeListener> CreateAsync(EndPoint endPoint, IMuninNode node, CancellationToken cancellationToken);
}

public sealed class MuninNodeClientDisconnectedException : InvalidOperationException {
public MuninNodeClientDisconnectedException() {}
public MuninNodeClientDisconnectedException(string message) {}
public MuninNodeClientDisconnectedException(string message, Exception innerException) {}
}
}

namespace Smdn.Net.MuninPlugin {
public interface INodeSessionCallback {
ValueTask ReportSessionClosedAsync(string sessionId, CancellationToken cancellationToken);
Expand Down Expand Up @@ -125,6 +242,20 @@ public enum PluginFieldGraphStyle : int {
Stack = 2,
}

public sealed class AggregatePluginProvider :
ReadOnlyCollection<IPluginProvider>,
INodeSessionCallback,
IPluginProvider
{
public AggregatePluginProvider(IList<IPluginProvider> pluginProviders) {}

public IReadOnlyCollection<IPlugin> Plugins { get; }
INodeSessionCallback? IPluginProvider.SessionCallback { get; }

async ValueTask INodeSessionCallback.ReportSessionClosedAsync(string sessionId, CancellationToken cancellationToken) {}
async ValueTask INodeSessionCallback.ReportSessionStartedAsync(string sessionId, CancellationToken cancellationToken) {}
}

public class Plugin :
INodeSessionCallback,
IPlugin,
Expand Down
Loading