@@ -34,10 +34,11 @@ public ConcreteLocalNode(
3434 IPluginProvider pluginProvider ,
3535 string hostName ,
3636 int port ,
37+ IAccessRule ? accessRule ,
3738 IServiceProvider ? serviceProvider = null
3839 )
3940 : base (
40- accessRule : serviceProvider ? . GetService < IAccessRule > ( ) ,
41+ accessRule : accessRule ?? serviceProvider ? . GetService < IAccessRule > ( ) ,
4142 logger : serviceProvider ? . GetService < ILoggerFactory > ( ) ? . CreateLogger < LocalNode > ( )
4243 )
4344 {
@@ -66,9 +67,13 @@ protected override EndPoint GetLocalEndPointToBind()
6667 /// The hostname advertised by this node. This value is used as the display name for HTML generated by Munin.
6768 /// If <see langword="null"/> or empty, the default hostname is used.
6869 /// </param>
70+ /// <param name="addressListAllowFrom">
71+ /// The <see cref="IReadOnlyList{IPAddress}"/> indicates the read-only list of addresses allowed to access <see cref="LocalNode"/>.
72+ /// </param>
6973 /// <param name="serviceProvider">
7074 /// The <see cref="IServiceProvider"/>.
71- /// This constructor overload attempts to get a service of <see cref="ILoggerFactory"/>, to create an <see cref="ILogger"/>.
75+ /// This overload attempts to get a service of <see cref="ILoggerFactory"/>, to create an <see cref="ILogger"/>.
76+ /// Also attempts to get a service of <see cref="IAccessRule"/> if <paramref name="addressListAllowFrom"/> is <see langword="null"/>.
7277 /// </param>
7378 /// <remarks>
7479 /// Most Munin-Node uses port 4949 by default, but it is recommended to use other port numbers to avoid conflicts with other nodes.
@@ -77,12 +82,14 @@ public static LocalNode Create(
7782 IReadOnlyCollection < IPlugin > plugins ,
7883 int port ,
7984 string ? hostName = null ,
85+ IReadOnlyList < IPAddress > ? addressListAllowFrom = null ,
8086 IServiceProvider ? serviceProvider = null
8187 )
8288 => Create (
8389 pluginProvider : new ReadOnlyCollectionPluginProvider ( plugins ?? throw new ArgumentNullException ( nameof ( plugins ) ) ) ,
8490 hostName : string . IsNullOrEmpty ( hostName ) ? DefaultHostName : hostName ,
8591 port : port ,
92+ addressListAllowFrom : addressListAllowFrom ,
8693 serviceProvider : serviceProvider
8794 ) ;
8895
@@ -99,9 +106,13 @@ public static LocalNode Create(
99106 /// The hostname advertised by this node. This value is used as the display name for HTML generated by Munin.
100107 /// If <see langword="null"/> or empty, the default hostname is used.
101108 /// </param>
109+ /// <param name="addressListAllowFrom">
110+ /// The <see cref="IReadOnlyList{IPAddress}"/> indicates the read-only list of addresses allowed to access <see cref="LocalNode"/>.
111+ /// </param>
102112 /// <param name="serviceProvider">
103113 /// The <see cref="IServiceProvider"/>.
104- /// This constructor overload attempts to get a service of <see cref="ILoggerFactory"/>, to create an <see cref="ILogger"/>.
114+ /// This overload attempts to get a service of <see cref="ILoggerFactory"/>, to create an <see cref="ILogger"/>.
115+ /// Also attempts to get a service of <see cref="IAccessRule"/> if <paramref name="addressListAllowFrom"/> is <see langword="null"/>.
105116 /// </param>
106117 /// <remarks>
107118 /// Most Munin-Node uses port 4949 by default, but it is recommended to use other port numbers to avoid conflicts with other nodes.
@@ -110,12 +121,14 @@ public static LocalNode Create(
110121 IPluginProvider pluginProvider ,
111122 int port ,
112123 string ? hostName = null ,
124+ IReadOnlyList < IPAddress > ? addressListAllowFrom = null ,
113125 IServiceProvider ? serviceProvider = null
114126 )
115127 => new ConcreteLocalNode (
116128 pluginProvider : pluginProvider ?? throw new ArgumentNullException ( nameof ( pluginProvider ) ) ,
117129 hostName : string . IsNullOrEmpty ( hostName ) ? DefaultHostName : hostName ,
118130 port : port ,
131+ accessRule : addressListAllowFrom is null ? null : new AddressListAccessRule ( addressListAllowFrom ) ,
119132 serviceProvider : serviceProvider
120133 ) ;
121134}
0 commit comments