Skip to content

Commit

Permalink
修复端口分流规则自动添加未能关联ip分组的bug,本次修改更新了一下config.yml的默认内容,请注意更新您的配置文件。[[#30]](#…
Browse files Browse the repository at this point in the history
  • Loading branch information
joyanhui committed Oct 4, 2024
1 parent 668fd64 commit af89a2f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ikuai需要分配3个网口(分别绑定到wan1 wan2 lan1),openwrt需要2
- `before` : 先删除旧规则再更新新规则,如果更新失败会丢失规则

## 更新日志
- 2024-10-04 修复端口分流规则自动添加未能关联ip分组的bug,本次修改更新了一下config.yml的默认内容,请注意更新您的配置文件。[[#30]](https://github.com/joyanhui/ikuai-bypass/issues/30)
- 2024-10-04 修复清理模式的删除规则问题 [[#27#issuecomment-2388114699]](https://github.com/joyanhui/ikuai-bypass/issues/27#issuecomment-2388114699)
- 2024-10-04 ip分组第一行的备注问题 [[#22]](https://github.com/joyanhui/ikuai-bypass/issues/22)
- 2024-10-04 修复 卡`ip分组== 正在查询 备注为: IKUAI_BYPASS_ 的ip分组规则` 的bug [[#24]](https://github.com/joyanhui/ikuai-bypass/issues/24) [[#27]](https://github.com/joyanhui/ikuai-bypass/issues/27)
Expand Down
7 changes: 4 additions & 3 deletions api/ip_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package api
import (
"errors"
"log"
"regexp"
"strconv"
"strings"
)
Expand Down Expand Up @@ -199,8 +198,10 @@ func (i *IKuai) GetAllIKuaiBypassIpGroupNamesByName(name string) (names []string
data, err = i.ShowIpGroupByName(name)

for _, d := range data {
match, _ := regexp.MatchString(name+`_\d+`, d.GroupName)
if d.Comment == COMMENT_IKUAI_BYPASS && match {
//match, _ := regexp.MatchString(name+`_\d+`, d.GroupName)
//log.Println(d.GroupName)
match := strings.Contains(d.GroupName, name)
if (d.Comment == COMMENT_IKUAI_BYPASS || strings.Contains(d.Comment, COMMENT_IKUAI_BYPASS)) && match {
names = append(names, d.GroupName)
}
}
Expand Down
4 changes: 2 additions & 2 deletions api/stream_ipport.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type StreamIpPortData struct {
Type int `json:"type"`
}

func (i *IKuai) AddStreamIpPort(forwardType string, iface string, dstAddr string, srcAddr string, nexthop string) error {
func (i *IKuai) AddStreamIpPort(forwardType string, iface string, dstAddr string, srcAddr string, nexthop string, tag string) error {

param := struct {
Interface string `json:"interface"`
Expand All @@ -53,7 +53,7 @@ func (i *IKuai) AddStreamIpPort(forwardType string, iface string, dstAddr string
Type: forwardType,
Nexthop: nexthop,
IfaceBand: 0,
Comment: COMMENT_IKUAI_BYPASS,
Comment: COMMENT_IKUAI_BYPASS + "_" + tag,
}
req := CallReq{
FuncName: FUNC_NAME_STREAM_IPPORT,
Expand Down
3 changes: 1 addition & 2 deletions helperFunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ func updateStreamIpPort(iKuai *api.IKuai, forwardType string, iface string, next
}
ipGroupList = append(ipGroupList, data...)
}

err = iKuai.AddStreamIpPort(forwardType, iface, strings.Join(ipGroupList, ","), srcAddr, nexthop)
err = iKuai.AddStreamIpPort(forwardType, iface, strings.Join(ipGroupList, ","), srcAddr, nexthop, ipGroup)
if err != nil {
log.Println("ip端口分流== 添加失败,可能是列表太多了,添加太快,爱快没响应。", conf.AddErrRetryWait, "秒后重试", err)
time.Sleep(conf.AddErrRetryWait)
Expand Down
2 changes: 1 addition & 1 deletion runModeUpdateIpgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func updateIpgroup() {
log.Println("登录爱快失败:", err)
return
}
log.Println("Tips: 在添加之前会强制删除所有备注包含 IKUAI_BYPASS 字符的ip分组和端口分流,不受delOldRule参数影响 2024-10-04 by joyanhui")
log.Println("Tips: 在添加之前会强制删除所有备注包含 IKUAI_BYPASS 字符的ip分组和端口分流,不受delOldRule参数影响,后续版本会尝试完善 2024-10-04 by joyanhui")

err = iKuai.DelIKuaiBypassIpGroup("cleanAll")
if err != nil {
Expand Down

0 comments on commit af89a2f

Please sign in to comment.