diff --git a/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net6.0.apilist.cs b/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net6.0.apilist.cs index 130febd..62a4f2b 100644 --- a/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net6.0.apilist.cs +++ b/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net6.0.apilist.cs @@ -1,7 +1,7 @@ -// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-1.3.0) +// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-2.0.0) // Name: Smdn.Net.MuninNode -// AssemblyVersion: 1.3.0.0 -// InformationalVersion: 1.3.0+191d215fe57392cb544e2ffea221644a1007cfc0 +// AssemblyVersion: 2.0.0.0 +// InformationalVersion: 2.0.0+0c4121c0bc87932e6486c3b38a123cb59460ac02 // TargetFramework: .NETCoreApp,Version=v6.0 // Configuration: Release // Referenced assemblies: @@ -27,43 +27,43 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Smdn.Net.MuninNode; using Smdn.Net.MuninPlugin; namespace Smdn.Net.MuninNode { - public class LocalNode : NodeBase { - public LocalNode(IPluginProvider pluginProvider, string hostName, int port, ILogger? logger = null) {} - public LocalNode(IPluginProvider pluginProvider, string hostName, int port, IServiceProvider? serviceProvider = null) {} - public LocalNode(IReadOnlyCollection plugins, int port, IServiceProvider? serviceProvider = null) {} - public LocalNode(IReadOnlyCollection plugins, string hostName, int port, IServiceProvider? serviceProvider = null) {} + public interface IAccessRule { + bool IsAcceptable(IPEndPoint remoteEndPoint); + } + + public static class IAccessRuleServiceCollectionExtensions { + public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IAccessRule accessRule) {} + public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IReadOnlyList addressListAllowFrom) {} + } - public IPEndPoint LocalEndPoint { get; } + public abstract class LocalNode : NodeBase { + public static LocalNode Create(IPluginProvider pluginProvider, int port, string? hostName = null, IReadOnlyList? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {} + public static LocalNode Create(IReadOnlyCollection plugins, int port, string? hostName = null, IReadOnlyList? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {} + + protected LocalNode(IAccessRule? accessRule, ILogger? logger = null) {} protected override Socket CreateServerSocket() {} - protected override bool IsClientAcceptable(IPEndPoint remoteEndPoint) {} + protected virtual EndPoint GetLocalEndPointToBind() {} } public abstract class NodeBase : IAsyncDisposable, IDisposable { - private protected class PluginProvider : IPluginProvider { - public PluginProvider(IReadOnlyCollection plugins) {} - - public IReadOnlyCollection Plugins { get; } - public INodeSessionCallback? SessionCallback { get; } - } - - protected NodeBase(IPluginProvider pluginProvider, string hostName, ILogger? logger) {} - protected NodeBase(IReadOnlyCollection plugins, string hostName, ILogger? logger) {} + protected NodeBase(IAccessRule? accessRule, ILogger? logger) {} public virtual Encoding Encoding { get; } - public string HostName { get; } + public abstract string HostName { get; } + public EndPoint LocalEndPoint { get; } protected ILogger? Logger { get; } public virtual Version NodeVersion { get; } - [Obsolete("This member will be deprecated in future version.")] - public IReadOnlyCollection Plugins { get; } + public abstract IPluginProvider PluginProvider { get; } public async ValueTask AcceptAsync(bool throwIfCancellationRequested, CancellationToken cancellationToken) {} public async ValueTask AcceptSingleSessionAsync(CancellationToken cancellationToken = default) {} @@ -72,8 +72,8 @@ protected virtual void Dispose(bool disposing) {} public void Dispose() {} public async ValueTask DisposeAsync() {} protected virtual async ValueTask DisposeAsyncCore() {} - protected abstract bool IsClientAcceptable(IPEndPoint remoteEndPoint); public void Start() {} + protected void ThrowIfPluginProviderIsNull() {} } } @@ -85,7 +85,7 @@ public interface INodeSessionCallback { public interface IPlugin { IPluginDataSource DataSource { get; } - PluginGraphAttributes GraphAttributes { get; } + IPluginGraphAttributes GraphAttributes { get; } string Name { get; } INodeSessionCallback? SessionCallback { get; } } @@ -101,6 +101,10 @@ public interface IPluginField { ValueTask GetFormattedValueStringAsync(CancellationToken cancellationToken); } + public interface IPluginGraphAttributes { + IEnumerable EnumerateAttributes(); + } + public interface IPluginProvider { IReadOnlyCollection Plugins { get; } INodeSessionCallback? SessionCallback { get; } @@ -132,6 +136,7 @@ public Plugin(string name, PluginGraphAttributes graphAttributes, IReadOnlyColle public PluginGraphAttributes GraphAttributes { get; } public string Name { get; } IPluginDataSource IPlugin.DataSource { get; } + IPluginGraphAttributes IPlugin.GraphAttributes { get; } INodeSessionCallback? IPlugin.SessionCallback { get; } IReadOnlyCollection IPluginDataSource.Fields { get; } @@ -170,11 +175,9 @@ protected PluginFieldBase(string label, string? name, PluginFieldGraphStyle grap async ValueTask IPluginField.GetFormattedValueStringAsync(CancellationToken cancellationToken) {} } - public sealed class PluginGraphAttributes { - [Obsolete("This member will be deprecated in future version.")] - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan updateRate, int? width = null, int? height = null) {} - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate = null, int? width = null, int? height = null) {} - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate, int? width, int? height, IEnumerable? order) {} + public sealed class PluginGraphAttributes : IPluginGraphAttributes { + public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments) {} + public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate, int? width, int? height, IEnumerable? order, string? totalValueLabel) {} public string Arguments { get; } public string Category { get; } @@ -182,9 +185,12 @@ public PluginGraphAttributes(string title, string category, string verticalLabel public string? Order { get; } public bool Scale { get; } public string Title { get; } + public string? TotalValueLabel { get; } public TimeSpan? UpdateRate { get; } public string VerticalLabel { get; } public int? Width { get; } + + public IEnumerable EnumerateAttributes() {} } public readonly struct PluginFieldAttributes { diff --git a/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net8.0.apilist.cs b/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net8.0.apilist.cs index 73b3402..d282525 100644 --- a/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net8.0.apilist.cs +++ b/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-net8.0.apilist.cs @@ -1,7 +1,7 @@ -// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-1.3.0) +// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-2.0.0) // Name: Smdn.Net.MuninNode -// AssemblyVersion: 1.3.0.0 -// InformationalVersion: 1.3.0+191d215fe57392cb544e2ffea221644a1007cfc0 +// AssemblyVersion: 2.0.0.0 +// InformationalVersion: 2.0.0+0c4121c0bc87932e6486c3b38a123cb59460ac02 // TargetFramework: .NETCoreApp,Version=v8.0 // Configuration: Release // Referenced assemblies: @@ -27,43 +27,43 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Smdn.Net.MuninNode; using Smdn.Net.MuninPlugin; namespace Smdn.Net.MuninNode { - public class LocalNode : NodeBase { - public LocalNode(IPluginProvider pluginProvider, string hostName, int port, ILogger? logger = null) {} - public LocalNode(IPluginProvider pluginProvider, string hostName, int port, IServiceProvider? serviceProvider = null) {} - public LocalNode(IReadOnlyCollection plugins, int port, IServiceProvider? serviceProvider = null) {} - public LocalNode(IReadOnlyCollection plugins, string hostName, int port, IServiceProvider? serviceProvider = null) {} + public interface IAccessRule { + bool IsAcceptable(IPEndPoint remoteEndPoint); + } + + public static class IAccessRuleServiceCollectionExtensions { + public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IAccessRule accessRule) {} + public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IReadOnlyList addressListAllowFrom) {} + } - public IPEndPoint LocalEndPoint { get; } + public abstract class LocalNode : NodeBase { + public static LocalNode Create(IPluginProvider pluginProvider, int port, string? hostName = null, IReadOnlyList? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {} + public static LocalNode Create(IReadOnlyCollection plugins, int port, string? hostName = null, IReadOnlyList? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {} + + protected LocalNode(IAccessRule? accessRule, ILogger? logger = null) {} protected override Socket CreateServerSocket() {} - protected override bool IsClientAcceptable(IPEndPoint remoteEndPoint) {} + protected virtual EndPoint GetLocalEndPointToBind() {} } public abstract class NodeBase : IAsyncDisposable, IDisposable { - private protected class PluginProvider : IPluginProvider { - public PluginProvider(IReadOnlyCollection plugins) {} - - public IReadOnlyCollection Plugins { get; } - public INodeSessionCallback? SessionCallback { get; } - } - - protected NodeBase(IPluginProvider pluginProvider, string hostName, ILogger? logger) {} - protected NodeBase(IReadOnlyCollection plugins, string hostName, ILogger? logger) {} + protected NodeBase(IAccessRule? accessRule, ILogger? logger) {} public virtual Encoding Encoding { get; } - public string HostName { get; } + public abstract string HostName { get; } + public EndPoint LocalEndPoint { get; } protected ILogger? Logger { get; } public virtual Version NodeVersion { get; } - [Obsolete("This member will be deprecated in future version.")] - public IReadOnlyCollection Plugins { get; } + public abstract IPluginProvider PluginProvider { get; } public async ValueTask AcceptAsync(bool throwIfCancellationRequested, CancellationToken cancellationToken) {} public async ValueTask AcceptSingleSessionAsync(CancellationToken cancellationToken = default) {} @@ -72,8 +72,8 @@ protected virtual void Dispose(bool disposing) {} public void Dispose() {} public async ValueTask DisposeAsync() {} protected virtual async ValueTask DisposeAsyncCore() {} - protected abstract bool IsClientAcceptable(IPEndPoint remoteEndPoint); public void Start() {} + protected void ThrowIfPluginProviderIsNull() {} } } @@ -85,7 +85,7 @@ public interface INodeSessionCallback { public interface IPlugin { IPluginDataSource DataSource { get; } - PluginGraphAttributes GraphAttributes { get; } + IPluginGraphAttributes GraphAttributes { get; } string Name { get; } INodeSessionCallback? SessionCallback { get; } } @@ -101,6 +101,10 @@ public interface IPluginField { ValueTask GetFormattedValueStringAsync(CancellationToken cancellationToken); } + public interface IPluginGraphAttributes { + IEnumerable EnumerateAttributes(); + } + public interface IPluginProvider { IReadOnlyCollection Plugins { get; } INodeSessionCallback? SessionCallback { get; } @@ -132,6 +136,7 @@ public Plugin(string name, PluginGraphAttributes graphAttributes, IReadOnlyColle public PluginGraphAttributes GraphAttributes { get; } public string Name { get; } IPluginDataSource IPlugin.DataSource { get; } + IPluginGraphAttributes IPlugin.GraphAttributes { get; } INodeSessionCallback? IPlugin.SessionCallback { get; } IReadOnlyCollection IPluginDataSource.Fields { get; } @@ -170,11 +175,9 @@ protected PluginFieldBase(string label, string? name, PluginFieldGraphStyle grap async ValueTask IPluginField.GetFormattedValueStringAsync(CancellationToken cancellationToken) {} } - public sealed class PluginGraphAttributes { - [Obsolete("This member will be deprecated in future version.")] - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan updateRate, int? width = null, int? height = null) {} - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate = null, int? width = null, int? height = null) {} - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate, int? width, int? height, IEnumerable? order) {} + public sealed class PluginGraphAttributes : IPluginGraphAttributes { + public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments) {} + public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate, int? width, int? height, IEnumerable? order, string? totalValueLabel) {} public string Arguments { get; } public string Category { get; } @@ -182,9 +185,12 @@ public PluginGraphAttributes(string title, string category, string verticalLabel public string? Order { get; } public bool Scale { get; } public string Title { get; } + public string? TotalValueLabel { get; } public TimeSpan? UpdateRate { get; } public string VerticalLabel { get; } public int? Width { get; } + + public IEnumerable EnumerateAttributes() {} } public readonly struct PluginFieldAttributes { diff --git a/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-netstandard2.1.apilist.cs index 48ee340..db8e8bb 100644 --- a/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-netstandard2.1.apilist.cs +++ b/doc/api-list/Smdn.Net.MuninNode/Smdn.Net.MuninNode-netstandard2.1.apilist.cs @@ -1,7 +1,7 @@ -// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-1.3.0) +// Smdn.Net.MuninNode.dll (Smdn.Net.MuninNode-2.0.0) // Name: Smdn.Net.MuninNode -// AssemblyVersion: 1.3.0.0 -// InformationalVersion: 1.3.0+191d215fe57392cb544e2ffea221644a1007cfc0 +// AssemblyVersion: 2.0.0.0 +// InformationalVersion: 2.0.0+0c4121c0bc87932e6486c3b38a123cb59460ac02 // TargetFramework: .NETStandard,Version=v2.1 // Configuration: Release // Referenced assemblies: @@ -20,43 +20,43 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Smdn.Net.MuninNode; using Smdn.Net.MuninPlugin; namespace Smdn.Net.MuninNode { - public class LocalNode : NodeBase { - public LocalNode(IPluginProvider pluginProvider, string hostName, int port, ILogger? logger = null) {} - public LocalNode(IPluginProvider pluginProvider, string hostName, int port, IServiceProvider? serviceProvider = null) {} - public LocalNode(IReadOnlyCollection plugins, int port, IServiceProvider? serviceProvider = null) {} - public LocalNode(IReadOnlyCollection plugins, string hostName, int port, IServiceProvider? serviceProvider = null) {} + public interface IAccessRule { + bool IsAcceptable(IPEndPoint remoteEndPoint); + } + + public static class IAccessRuleServiceCollectionExtensions { + public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IAccessRule accessRule) {} + public static IServiceCollection AddMuninNodeAccessRule(this IServiceCollection services, IReadOnlyList addressListAllowFrom) {} + } - public IPEndPoint LocalEndPoint { get; } + public abstract class LocalNode : NodeBase { + public static LocalNode Create(IPluginProvider pluginProvider, int port, string? hostName = null, IReadOnlyList? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {} + public static LocalNode Create(IReadOnlyCollection plugins, int port, string? hostName = null, IReadOnlyList? addressListAllowFrom = null, IServiceProvider? serviceProvider = null) {} + + protected LocalNode(IAccessRule? accessRule, ILogger? logger = null) {} protected override Socket CreateServerSocket() {} - protected override bool IsClientAcceptable(IPEndPoint remoteEndPoint) {} + protected virtual EndPoint GetLocalEndPointToBind() {} } public abstract class NodeBase : IAsyncDisposable, IDisposable { - private protected class PluginProvider : IPluginProvider { - public PluginProvider(IReadOnlyCollection plugins) {} - - public IReadOnlyCollection Plugins { get; } - public INodeSessionCallback? SessionCallback { get; } - } - - protected NodeBase(IPluginProvider pluginProvider, string hostName, ILogger? logger) {} - protected NodeBase(IReadOnlyCollection plugins, string hostName, ILogger? logger) {} + protected NodeBase(IAccessRule? accessRule, ILogger? logger) {} public virtual Encoding Encoding { get; } - public string HostName { get; } + public abstract string HostName { get; } + public EndPoint LocalEndPoint { get; } protected ILogger? Logger { get; } public virtual Version NodeVersion { get; } - [Obsolete("This member will be deprecated in future version.")] - public IReadOnlyCollection Plugins { get; } + public abstract IPluginProvider PluginProvider { get; } public async ValueTask AcceptAsync(bool throwIfCancellationRequested, CancellationToken cancellationToken) {} public async ValueTask AcceptSingleSessionAsync(CancellationToken cancellationToken = default) {} @@ -65,8 +65,8 @@ protected virtual void Dispose(bool disposing) {} public void Dispose() {} public async ValueTask DisposeAsync() {} protected virtual ValueTask DisposeAsyncCore() {} - protected abstract bool IsClientAcceptable(IPEndPoint remoteEndPoint); public void Start() {} + protected void ThrowIfPluginProviderIsNull() {} } } @@ -78,7 +78,7 @@ public interface INodeSessionCallback { public interface IPlugin { IPluginDataSource DataSource { get; } - PluginGraphAttributes GraphAttributes { get; } + IPluginGraphAttributes GraphAttributes { get; } string Name { get; } INodeSessionCallback? SessionCallback { get; } } @@ -94,6 +94,10 @@ public interface IPluginField { ValueTask GetFormattedValueStringAsync(CancellationToken cancellationToken); } + public interface IPluginGraphAttributes { + IEnumerable EnumerateAttributes(); + } + public interface IPluginProvider { IReadOnlyCollection Plugins { get; } INodeSessionCallback? SessionCallback { get; } @@ -125,6 +129,7 @@ public Plugin(string name, PluginGraphAttributes graphAttributes, IReadOnlyColle public PluginGraphAttributes GraphAttributes { get; } public string Name { get; } IPluginDataSource IPlugin.DataSource { get; } + IPluginGraphAttributes IPlugin.GraphAttributes { get; } INodeSessionCallback? IPlugin.SessionCallback { get; } IReadOnlyCollection IPluginDataSource.Fields { get; } @@ -163,11 +168,9 @@ protected PluginFieldBase(string label, string? name, PluginFieldGraphStyle grap async ValueTask IPluginField.GetFormattedValueStringAsync(CancellationToken cancellationToken) {} } - public sealed class PluginGraphAttributes { - [Obsolete("This member will be deprecated in future version.")] - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan updateRate, int? width = null, int? height = null) {} - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate = null, int? width = null, int? height = null) {} - public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate, int? width, int? height, IEnumerable? order) {} + public sealed class PluginGraphAttributes : IPluginGraphAttributes { + public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments) {} + public PluginGraphAttributes(string title, string category, string verticalLabel, bool scale, string arguments, TimeSpan? updateRate, int? width, int? height, IEnumerable? order, string? totalValueLabel) {} public string Arguments { get; } public string Category { get; } @@ -175,9 +178,12 @@ public PluginGraphAttributes(string title, string category, string verticalLabel public string? Order { get; } public bool Scale { get; } public string Title { get; } + public string? TotalValueLabel { get; } public TimeSpan? UpdateRate { get; } public string VerticalLabel { get; } public int? Width { get; } + + public IEnumerable EnumerateAttributes() {} } public readonly struct PluginFieldAttributes {