Skip to content

Commit

Permalink
Merge pull request #947 from bfenetworks/release/v1.5.0
Browse files Browse the repository at this point in the history
Release/v1.5.0
  • Loading branch information
clarinette9 authored Jan 11, 2022
2 parents 3ed1851 + 5761205 commit 99cabc5
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ coverage.txt
.vscode/*
bfe
dist/*

.DS_Store
4 changes: 4 additions & 0 deletions bfe_modules/mod_tcp_keepalive/keepalive_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ func setCount(fd int, n int) error {
func setInterval(fd int, secs int) error {
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, _TCP_KEEPINTVL, secs))
}

func setNonblock(fd int) error {
return os.NewSyscallError("setsockopt", syscall.SetNonblock(fd, true))
}
4 changes: 4 additions & 0 deletions bfe_modules/mod_tcp_keepalive/keepalive_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ func setCount(fd int, n int) error {
func setInterval(fd int, secs int) error {
return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, secs))
}

func setNonblock(fd int) error {
return os.NewSyscallError("setsockopt", syscall.SetNonblock(fd, true))
}
51 changes: 51 additions & 0 deletions bfe_modules/mod_tcp_keepalive/keepalive_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) 2021 The BFE Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package mod_tcp_keepalive

import (
"github.com/baidu/go-lib/log"
)

func setIdle(fd int, secs int) error {
if openDebug {
log.Logger.Debug("mod[mod_tcp_keepalive] setIdle not implemented")
}

return nil
}

func setCount(fd int, n int) error {
if openDebug {
log.Logger.Debug("mod[mod_tcp_keepalive] setCount not implemented")
}

return nil
}

func setInterval(fd int, secs int) error {
if openDebug {
log.Logger.Debug("mod[mod_tcp_keepalive] setInterval not implemented")
}

return nil
}

func setNonblock(fd int) error {
if openDebug {
log.Logger.Debug("mod[mod_tcp_keepalive] setNonblock not implemented")
}

return nil
}
5 changes: 0 additions & 5 deletions bfe_modules/mod_tcp_keepalive/mod_tcp_keepalive.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"net/url"
"os"
"reflect"
"syscall"

"github.com/baidu/go-lib/log"
"github.com/baidu/go-lib/web-monitor/metrics"
Expand Down Expand Up @@ -142,10 +141,6 @@ func (m *ModuleTcpKeepAlive) disableKeepAlive(tcpConn *net.TCPConn) error {
return nil
}

func setNonblock(fd int) error {
return os.NewSyscallError("setsockopt", syscall.SetNonblock(fd, true))
}

func (m *ModuleTcpKeepAlive) setKeepAliveParam(conn *net.TCPConn, p KeepAliveParam) error {
var err error
var f *os.File
Expand Down
1 change: 1 addition & 0 deletions conf/bfe.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ ClusterTableConf = cluster_conf/cluster_table.data
GslbConf = cluster_conf/gslb.data

Modules = mod_trust_clientip
# Modules = mod_tcp_keepalive
Modules = mod_block
Modules = mod_header
Modules = mod_rewrite
Expand Down
2 changes: 1 addition & 1 deletion conf/mod_tcp_keepalive/mod_tcp_keepalive.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[basic]
DataPath = ../data/mod_tcp_keepalive/tcp_keepalive.data
DataPath = mod_tcp_keepalive/tcp_keepalive.data

[log]
OpenDebug = false
14 changes: 14 additions & 0 deletions conf/mod_tcp_keepalive/tcp_keepalive.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Config": {
"product1": [
{
"VipConf": ["180.97.93.196"],
"KeepAliveParam": {
"KeepIdle": 270,
"KeepIntvl": 9
}
}
]
},
"Version": "2021-06-25 14:31:05"
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ require (
go.elastic.co/apm/module/apmhttp v1.7.2 // indirect
go.elastic.co/fastjson v1.1.0 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/grpc v1.22.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
Expand Down

0 comments on commit 99cabc5

Please sign in to comment.