对于这个请求,您有 2 个选择。
选项 1 - 使用 REST 方法设置 IP 过滤器
第 1 步 - 删除 /AMS_DIR/webapps/root/WEB-INF/web.xml 中的以下代码 sn-ps
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>io.antmedia.console.rest.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>
第 2 步 - 使用以下支持 GET 方法的 REST 方法请求应用程序设置
http://domain-address.com:5080/rest/getSettings/WebRTCAppEE
返回该应用程序的设置对象。
第 3 步 - 在设置对象中添加/编辑 remoteAllowedCIDR 字段并将设置发送到对象到下面的以下 REST 方法。
http://domain-address:5080/rest/changeSettings/WebRTCAppEE
请求类型:POST
内容类型:application/json
您可以将逗号分隔的 CIDR 表示法或 IP 地址添加到 remoteAllowedCIDR。例如:
remoteAllowedCIDR=127.0.0.1,12.44.55.3/24,192.123.33.66
注意:您可以更改请求 https、端口地址、WebRTCAppEE 等应用程序
选项 2 - 使用 MongoDB 设置 IP 过滤器
第 1 步 - 更新 MongoDB 中设置对象中的 settings.remoteAllowedCIDR 和 updateTime 字段 -> clusterdb -> AppSettings collection。此外,您可以将 MongoDB 与服务连接。
a- 你可以像上面一样更改settings.remoteAllowedCIDR
b- 您还应该更新 updateTime 字段。您可以以毫秒为单位设置当前时间(System.currentTimeMillis())。让我提供一些关于为什么我们需要更新 updateTime 的更多信息。
每个 AMS 都会定期检查 AppSettings 中的 updateTime 字段以更新应用程序设置。所以,在更新remoteAllowedCIDR字段之后,你需要更新updateTime字段,让每个节点自己更新。
注意:在 clusterdb 中,应用程序设置作为集合存储在 MongoDB 中。
您还可以查看以下有关 MongoDB 事务和 AppSettings 类的文档:
https://docs.mongodb.com/manual/core/transactions-in-applications/
https://docs.mongodb.com/manual/crud/#update-operations
https://github.com/ant-media/Ant-Media-Server-Common/blob/master/src/main/java/io/antmedia/AppSettings.java#L533