feat: add TAP device mode and Ethernet interoperability
This commit is contained in:
@@ -26,7 +26,7 @@ public class VntConfig {
|
||||
private final boolean rtx;
|
||||
private final boolean fec;
|
||||
private final boolean noNat;
|
||||
private final boolean noTun;
|
||||
private final String deviceMode;
|
||||
private final Integer mtu;
|
||||
private final boolean allowMapping;
|
||||
private final List<String> portMapping;
|
||||
@@ -48,7 +48,7 @@ public class VntConfig {
|
||||
this.rtx = builder.rtx;
|
||||
this.fec = builder.fec;
|
||||
this.noNat = builder.noNat;
|
||||
this.noTun = builder.noTun;
|
||||
this.deviceMode = builder.deviceMode;
|
||||
this.mtu = builder.mtu;
|
||||
this.allowMapping = builder.allowMapping;
|
||||
this.portMapping = builder.portMapping;
|
||||
@@ -86,7 +86,7 @@ public class VntConfig {
|
||||
json.put("rtx", rtx);
|
||||
json.put("fec", fec);
|
||||
json.put("no_nat", noNat);
|
||||
json.put("no_tun", noTun);
|
||||
json.put("device_mode", deviceMode);
|
||||
json.put("allow_mapping", allowMapping);
|
||||
|
||||
// 数组
|
||||
@@ -135,7 +135,7 @@ public class VntConfig {
|
||||
private boolean rtx = false;
|
||||
private boolean fec = false;
|
||||
private boolean noNat = false;
|
||||
private boolean noTun = false;
|
||||
private String deviceMode = "tun";
|
||||
private Integer mtu;
|
||||
private boolean allowMapping = false;
|
||||
private List<String> portMapping = new ArrayList<>();
|
||||
@@ -258,10 +258,13 @@ public class VntConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* 无TUN模式(默认false)
|
||||
* 设置虚拟网卡模式:no、tun(默认)或 tap。
|
||||
*/
|
||||
public Builder setNoTun(boolean noTun) {
|
||||
this.noTun = noTun;
|
||||
public Builder setDeviceMode(String deviceMode) {
|
||||
if (!"no".equals(deviceMode) && !"tun".equals(deviceMode) && !"tap".equals(deviceMode)) {
|
||||
throw new IllegalArgumentException("deviceMode must be no, tun, or tap");
|
||||
}
|
||||
this.deviceMode = deviceMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user