fix: sharkdApi 协议支持可配置

This commit is contained in:
zhangshuai
2024-09-02 14:38:57 +08:00
parent 7137793307
commit 96c9b992af
2 changed files with 4 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ import java.util.stream.Collectors;
public class PcapServiceImpl extends ServiceImpl<PcapDao, PcapEntity> implements IPcapService {
private static final Log log = Log.get();
@Value("${sharkdApi.host:127.0.0.1}")
@Value("${sharkdApi.host:http://127.0.0.1}")
private String sharkdApiHostAddr;
@Autowired

View File

@@ -129,7 +129,7 @@ public class PcapParserThread implements Runnable {
String pcapId = pcapEntity.getId();
String pcapName = pcapEntity.getName();
String sharkdApiHostAddr = properties.getProperty("sharkdApiHostAddr", "127.0.0.1");
String sharkdApiHostAddr = properties.getProperty("sharkdApiHostAddr", "http://127.0.0.1");
for (Object obj : jsonArray) {
JSONObject pojo = (JSONObject) obj;
pojo.put("pcap.id", pcapId);
@@ -139,11 +139,11 @@ public class PcapParserThread implements Runnable {
Long streamId = T.MapUtil.getLong(pojo, "stream_id");
if (T.StrUtil.equalsIgnoreCase("tcp", proto)) {
pojo.put("pcap.tcp_stream", streamId);
pojo.put("pcap.stream_url", String.format("http://%s/navi/pcap/%s/tcp/%s", sharkdApiHostAddr, pcapId, streamId));
pojo.put("pcap.stream_url", String.format("%s/navi/pcap/%s/tcp/%s", sharkdApiHostAddr, pcapId, streamId));
}
if (T.StrUtil.equalsIgnoreCase("udp", proto)) {
pojo.put("pcap.udp_stream", streamId);
pojo.put("pcap.stream_url", String.format("http://%s/navi/pcap/%s/udp/%s", sharkdApiHostAddr, pcapId, streamId));
pojo.put("pcap.stream_url", String.format("%s/navi/pcap/%s/udp/%s", sharkdApiHostAddr, pcapId, streamId));
}
String resp = T.MapUtil.getStr(pojo, "id.resp_h", "");