-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
286 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ALTER TABLE `v2_server` | ||
ADD COLUMN `node_type` varchar(255) NULL COMMENT '节点类型' AFTER `remark`; | ||
|
||
update v2_server set node_type = 'vmess' where 1=1 |
27 changes: 27 additions & 0 deletions
27
v2node/src/main/java/com/ruoyi/system/constant/NodeTypeEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.ruoyi.system.constant; | ||
|
||
/** | ||
* @author xuehui_li | ||
* @Version 1.0 | ||
* @date 2024/11/19 9:45 | ||
* @Content | ||
*/ | ||
|
||
public enum NodeTypeEnum { | ||
VMESS("vmess"); | ||
|
||
String type; | ||
|
||
NodeTypeEnum(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.ruoyi.system.domain; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* @author xuehui_li | ||
* @Version 1.0 | ||
* @date 2024/11/19 9:39 | ||
* @Content | ||
*/ | ||
@Data | ||
public class NodeVo { | ||
|
||
String name; | ||
|
||
String currentDns; | ||
|
||
Long nodeId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
v2node/src/main/java/com/ruoyi/system/mapper/V2NodeVmessMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.ruoyi.system.mapper; | ||
|
||
import com.ruoyi.system.domain.NodeVo; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author xuehui_li | ||
* @Version 1.0 | ||
* @date 2024/11/19 9:53 | ||
* @Content | ||
*/ | ||
|
||
public interface V2NodeVmessMapper { | ||
List<NodeVo> queryList(NodeVo nodeVo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
v2node/src/main/java/com/ruoyi/system/service/V2Manager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.ruoyi.system.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
/** | ||
* @author xuehui_li | ||
* @Version 1.0 | ||
* @date 2024/11/19 10:01 | ||
* @Content | ||
*/ | ||
@Service | ||
public class V2Manager { | ||
HashMap<String, V2NodeService> nodeServiceMap = new HashMap<>(); | ||
|
||
public V2Manager(List<V2NodeService> serviceList) { | ||
for (V2NodeService v2NodeService : serviceList) { | ||
nodeServiceMap.put(v2NodeService.getType(), v2NodeService); | ||
} | ||
} | ||
|
||
public V2NodeService getV2NodeService(String type) { | ||
return nodeServiceMap.get(type); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
v2node/src/main/java/com/ruoyi/system/service/V2NodeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.ruoyi.system.service; | ||
|
||
import com.ruoyi.system.domain.NodeVo; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author xuehui_li | ||
* @Version 1.0 | ||
* @date 2024/11/19 9:38 | ||
* @Content | ||
*/ | ||
public interface V2NodeService { | ||
|
||
List<NodeVo> queryList(NodeVo nodeVo); | ||
|
||
String getType(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
v2node/src/main/java/com/ruoyi/system/service/impl/VmessServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.ruoyi.system.service.impl; | ||
|
||
import com.ruoyi.common.annotation.DataSource; | ||
import com.ruoyi.common.enums.DataSourceType; | ||
import com.ruoyi.system.constant.NodeTypeEnum; | ||
import com.ruoyi.system.domain.NodeVo; | ||
import com.ruoyi.system.mapper.V2NodeVmessMapper; | ||
import com.ruoyi.system.service.V2NodeService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author xuehui_li | ||
* @Version 1.0 | ||
* @date 2024/11/19 9:50 | ||
* @Content | ||
*/ | ||
@Service | ||
public class VmessServiceImpl implements V2NodeService { | ||
|
||
@Autowired | ||
V2NodeVmessMapper v2NodeVmessMapper; | ||
|
||
@Override | ||
@DataSource(value = DataSourceType.v2board) | ||
public List<NodeVo> queryList(NodeVo nodeVo) { | ||
return v2NodeVmessMapper.queryList(nodeVo); | ||
} | ||
|
||
@Override | ||
public String getType() { | ||
return NodeTypeEnum.VMESS.getType(); | ||
} | ||
} |
Oops, something went wrong.