Skip to content

Commit

Permalink
Merge Release/v1.7.0 into Master (#1211)
Browse files Browse the repository at this point in the history
* typo: fix docs/example markdown lint

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: code span on function prototype of bfe callback

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/introduction markdown lint and syntax

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/installation markdown lint and syntax

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/faq markdown lint and syntax

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/modules markdown lint

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/operation markdown lint

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/monitor markdown lint and syntax

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Add en_us/condition/request/context.md

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Add zh_cn/condition/request/context.md

Signed-off-by: Song Jian <songjian@yf-networks.com>

* add req_context_value_in() to condition_primitive_index.md and adjust sequence (#1010)

Signed-off-by: Song Jian <songjian@yf-networks.com>

* ci: add markdown lint action

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix docs/condition markdown lints

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Revert "chore: add typos in pre-commit"

Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_balance spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_basic BOM

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_config spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_fcgi spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_http bfe_server spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_http2 spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_module spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: format bfe_modules/mod_userid

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_route spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_spdy spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: fix bfe_tls spelling

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: format bfe_util/socket_util

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* chore: ignore log rotate files

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* typo: remove dot at the end

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Fix typo in  mod_geo (#1029)

Signed-off-by: suhang <1099811329@qq.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Add staticcheck pre-commit hook (#1019)

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Add precommit hook for markdownlint (#1038)

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Evict the oldest conn when the conn pool exceeds its limit (#1044)

Signed-off-by: chenchen.ccqy66 <chenchen.ccqy66@bytedance.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* import code-lint workflow job (#1037)

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix go.yaml dependency

Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix arm build error in golang1.18

Signed-off-by: Song Jian <songjian@yf-networks.com>

* refactor: replace strings.Replace with strings.ReplaceAll

strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Create some slices with enough capacity (#1054)

Signed-off-by: chenchen.ccqy66 <chenchen.ccqy66@bytedance.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update ci.yml (#1061)

Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix build failed on macos (#1067)

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Make some optimization for leastConnsBalance (#1062)

Signed-off-by: likepeng <likepeng@didiglobal.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Fix some unreachable code in unit tests (#1068)

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Support HTTP/2 fingerprint (#1072)

Signed-off-by: xqbumu <xqbumu@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* update v1.6.0 changelog

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* update changelog and version file

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update CHANGELOG.md

fix minor typo

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update condition_grammar.md

fix typos

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update README.md

Signed-off-by: Song Jian <songjian@yf-networks.com>

* update mkdocs yml and download link for v1.5 and v1.6 (#1084)

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Resolved #800 support test configuration

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update MAINTAINERS.md

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update MAINTAINERS.md

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* update maintainers.md

Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix some typo (#1113)

Signed-off-by: cui fliter <imcusg@gmail.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update ci.yml

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update ADOPTERS.md (#1123)

Signed-off-by: Benjamin <72671586+benjx1990@users.noreply.github.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* build(deps): bump golang.org/x/sys (#1101)

Bumps [golang.org/x/sys](/~https://github.com/golang/sys) from 0.0.0-20211216021012-1d35b9e2eb4e to 0.1.0.
- [Release notes](/~https://github.com/golang/sys/releases)
- [Commits](/~https://github.com/golang/sys/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* remove TestSetKeepAlive

Signed-off-by: liangchuan <liangchuan@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* remove TestSetKeepAlive

Signed-off-by: liangchuan <liangchuan@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Resubmit with Signed-off-by line

Signed-off-by: liangchuan <liangchuan@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Resubmit with Signed-off-by line

Signed-off-by: liangchuan <liangchuan@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* http2: close connections when receiving too many headers (#1156)

Maintaining HPACK state requires that we parse and process all HEADERS and CONTINUATION frames on a connection. When a request's headers exceed MaxHeaderBytes, we don't allocate memory to store the excess headers but we do parse them. This permits an attacker to cause an HTTP/2 endpoint to read arbitrary amounts of header data, all associated with a request which is going to be rejected. These headers can include Huffman-encoded data which is significantly more expensive for the receiver to decode than for an attacker to send.

Set a limit on the amount of excess header frames we will process before closing a connection.

This is CVE-2023-45288 and Go issue https://go.dev/issue/65051.

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update Dockerfile to support multiarch build (#1120)

Replace go compile args to TARGETOS and TARGETARCH to support multiarch compile

Signed-off-by: Allen Chen <watchword@gmail.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Fix format issue in bfe_http/request_test.go (#1163)

Signed-off-by: cuishuang <imcusg@gmail.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* Temporarily remove some test cases using legacy test data (#1193)

Signed-off-by: Song Jian <songjian@yf-networks.com>

* The experimental `dynamic plugin` is deprecated (#1197)

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Update versions of some thirdpaty modules (#1198)

Fix broken unit tests

Signed-off-by: Song Jian <songjian@yf-networks.com>

* Upgrade third-party modules for security reasons (#1201)

Remove duplicated code lint workflow

Signed-off-by: Sijie Yang <iyangsj@gmail.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* bfe_wasm

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* remove v2

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* remove redundant codes

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix OnPluginStart

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* refine codes

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix.

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix nil

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* rename package & remove some obsolete lines.

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* refine

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix & refine

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* docs of mod_wasmplugin

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* add link in summary.md to mod_wasmplugin

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* fix "bfe_http : readloop goroutine leak #1209"

Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>

* update changlog and version file for v1.7.0

Signed-off-by: Song Jian <songjian@yf-networks.com>

---------

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: Song Jian <songjian@yf-networks.com>
Signed-off-by: suhang <1099811329@qq.com>
Signed-off-by: chenchen.ccqy66 <chenchen.ccqy66@bytedance.com>
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Signed-off-by: likepeng <likepeng@didiglobal.com>
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Signed-off-by: xqbumu <xqbumu@163.com>
Signed-off-by: clarinette9 <songjiansuperman@163.com>
Signed-off-by: cui fliter <imcusg@gmail.com>
Signed-off-by: Benjamin <72671586+benjx1990@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: liangchuan <liangchuan@yf-networks.com>
Signed-off-by: Allen Chen <watchword@gmail.com>
Signed-off-by: cuishuang <imcusg@gmail.com>
Signed-off-by: Sijie Yang <iyangsj@gmail.com>
Signed-off-by: xuleiming <xuleiming@yf-networks.com>
Co-authored-by: kwanhur <huang_hua2012@163.com>
Co-authored-by: Sijie Yang <iyangsj@gmail.com>
Co-authored-by: Miles Zhang <zhangmiao02@baidu.com>
Co-authored-by: blinkbean <1099811329@qq.com>
Co-authored-by: wolfCoder <chenchen_839@126.com>
Co-authored-by: daimg <daiming@baidu.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: kezhenxu94 <kezhenxu94@apache.org>
Co-authored-by: supermario1990 <406517780@qq.com>
Co-authored-by: cooper-li <963492628@qq.com>
Co-authored-by: Abirdcfly <fp544037857@gmail.com>
Co-authored-by: 卜木 <xqbumu@gmail.com>
Co-authored-by: cui fliter <imcusg@gmail.com>
Co-authored-by: Benjamin <72671586+benjx1990@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: liangchuan <liangchuan@yf-networks.com>
Co-authored-by: z8n24 <zhaoxueqin24@Gmail.com>
Co-authored-by: watchword <watchword@gmail.com>
Co-authored-by: xuleiming <xuleiming@yf-networks.com>
Co-authored-by: Song Jian <songjian@yf-networks.com>
  • Loading branch information
21 people authored Jan 19, 2025
1 parent e22ca37 commit b1f1c66
Show file tree
Hide file tree
Showing 68 changed files with 2,102 additions and 473 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.21

# Build
- name: Build
Expand All @@ -75,8 +75,8 @@ jobs:
- name: setup Python
uses: actions/setup-python@v2
with:
python-version: '2.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: python -m SimpleHTTPServer 8181&
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: python3 -m http.server 8181&

# Modify Conf and Run
- name: Run
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ coverage.txt
.vscode/*
bfe
dist/*
conf/wasm_plugin

.DS_Store
32 changes: 0 additions & 32 deletions .markdownlint.yml

This file was deleted.

2 changes: 2 additions & 0 deletions ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Some of our users include:

* [Haier](https://www.haier.com)

* [PITS Global Data Recovery Services](https://pitsdatarecovery.net/)

* [Postal Savings Bank of China](https://www.psbc.com)

* [Resolink](https://www.crresolink.com.cn)
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,46 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.7.0] - 2025-01-19

### Added

- Support building docker images for multiple architectures
- Support WASM to allow dynamic plugin

### Fixed

- Upgrade versions of some third-paty modules for security reasons
- Fix format issue in bfe_http/request_test.go
- Temporarily remove some test cases using legacy test data
- mod_tcp_keepalive: fix broken unit tests
- http2: close connections when receiving too many headers
- Fix readloop goroutine leak

### Removed

- The previous experimental dynamic plugin is deprecated

## [v1.6.0] - 2022-10-21

### Added

- Allow user to disable monitor port ([Issue #936](/~https://github.com/bfenetworks/bfe/issues/936))
- Support HTTP2 fingerprint ([Issue #1071](/~https://github.com/bfenetworks/bfe/issues/1071))
- Documents optimization

### Changed

- Optimize idle connection handling ([Pull #1044](/~https://github.com/bfenetworks/bfe/pull/1044))
- Performance optimize in smooth least connection balancing algorithm([Pull #1062](/~https://github.com/bfenetworks/bfe/pull/1062))
- Miscellaneous golang dependency updates
- Miscellaneous improvements in makefile and other CI tools

### Fixed

- mod_trust_clientip: fix incorrect private IP address range ([Issue #856](/~https://github.com/bfenetworks/bfe/issues/856))
- arm build error in golang 1.18

## [v1.6.0] - 2022-10-21

### Added
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM golang:1.17.5-alpine3.15 AS build
FROM --platform=${BUILDPLATFORM} golang:1.17.5-alpine3.15 AS build
ARG TARGETARCH
ARG TARGETOS

WORKDIR /bfe
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=`cat VERSION`"
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags "-X main.version=`cat VERSION`"

FROM alpine:3.15 AS run
RUN apk update && apk add --no-cache ca-certificates
Expand Down
14 changes: 9 additions & 5 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ This file lists who are the maintainers of the BFE project. The responsibilities

| Name | GitHub ID | Affiliation |
| ---- | --------- | ----------- |
| [Miao Zhang](mailto:zhangmiao02@baidu.com) | [mileszhang2016](/~https://github.com/mileszhang2016) | Baidu |
| [Sijie Yang](mailto:iyangsj@gmail.com) | [iyangsj](/~https://github.com/iyangsj) | Baidu |
| [Miao Zhang](mailto:zhangmiao@yf-networks.com) | [mileszhang2016](/~https://github.com/mileszhang2016) | Yingfei Networks |
| [Sijie Yang](mailto:iyangsj@gmail.com) | [iyangsj](/~https://github.com/iyangsj) | Tencent |

## Senior Maintainers

| Name | GitHub ID | Affiliation |
| ---- | --------- | ----------- |
| [Sijie Yang](mailto:iyangsj@gmail.com) | [iyangsj](/~https://github.com/iyangsj) | Baidu |
| [Sijie Yang](mailto:iyangsj@gmail.com) | [iyangsj](/~https://github.com/iyangsj) | Tencent |

## Maintainers

| Name | GitHub ID | Affiliation |
| ---- | --------- | ----------- |
| [Derek Zheng](mailto:shanhu5739@gmail.com) | [shanhuhai5739](/~https://github.com/shanhuhai5739) | Kuaishou |
| [Xiaofei Yu](mailto:nemo_00o@hotmail.com) | [xiaofei0800](/~https://github.com/xiaofei0800) | Baidu |
| [Xiaofei Yu](mailto:nemo_00o@hotmail.com) | [xiaofei0800](/~https://github.com/xiaofei0800) | Tencent |
| [Wensi Yang](mailto:tianxinheihei@gmail.com) | [tianxinheihei](/~https://github.com/tianxinheihei) | ByteDance |
| [Kaiyu Zheng](mailto:412674752@qq.com) | [kaiyuzheng](/~https://github.com/kaiyuzheng) | ByteDance |
| [Yuqi Xiao](mailto:xiao19910705@163.com) | [Yuqi Xiao](/~https://github.com/YuqiXiao) | Baidu |
| [Yuqi Xiao](mailto:xiao19910705@163.com) | [YuqiXiao](/~https://github.com/YuqiXiao) | ByteDance |
| [Wei Wei](mailto:ww990114@gmail.com) | [weiwei99](/~https://github.com/weiwei99) | Baidu |
| [Andy Liang](mailto:lianglei@yf-networks.com) | [andyxmu](/~https://github.com/andyxmu) | Yingfei Networks |
| [Leiming Xu](mailto:xuleiming@yf-networks.com) | [xuleiming](/~https://github.com/xuleiming) | Yingfei Networks |
| [Jian Song](mailto:songjian@yf-networks.com) | [clarinette9](/~https://github.com/clarinette9) | Yingfei Networks |
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ strip: prepare compile-strip package
# make prepare, download dependencies
prepare: prepare-dep prepare-gen
prepare-dep:
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc)
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc@latest)
prepare-gen:
cd "bfe_basic/condition/parser" && $(GOGEN)

Expand Down Expand Up @@ -117,7 +117,7 @@ package:
# make deps
deps:
$(call PIP_INSTALL_PKG, pre-commit)
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc)
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc@latest)
$(call INSTALL_PKG, staticcheck, honnef.co/go/tools/cmd/staticcheck)
$(call INSTALL_PKG, license-eye, github.com/apache/skywalking-eyes/cmd/license-eye@latest)

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ Besides, we also implement [BFE Ingress Controller](/~https://github.com/bfenetwor
- [English version](https://www.bfe-networks.net/en_us/ABOUT/)
- [Chinese version](https://www.bfe-networks.net/zh_cn/ABOUT/)

## Book

- [In-depth Understanding of BFE](/~https://github.com/baidu/bfe-book) (Released in Feb 2023)

This book focuses on BFE open source project, introduces the relevant technical principles of network access, explains the design idea of BFE open source software, and how to build a network front-end platform based on BFE open source software. Readers with development capabilities can also develop BFE extension modules according to their own needs or contribute code to BFE open source projects according to the instructions in this book.


## Contributing

- Please create an issue in [issue list](http://github.com/bfenetworks/bfe/issues).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.0
1.7.0
28 changes: 24 additions & 4 deletions bfe.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var (
showVersion = flag.Bool("v", false, "to show version of bfe")
showVerbose = flag.Bool("V", false, "to show verbose information about bfe")
debugLog = flag.Bool("d", false, "to show debug log (otherwise >= info)")
testConf = flag.Bool("t", false, "test configuration and exit")
)

var version string
Expand Down Expand Up @@ -74,7 +75,12 @@ func main() {
logSwitch = "DEBUG"
bfe_debug.DebugIsOpen = true
} else {
logSwitch = "INFO"
// ignore under ERROR level
if *testConf {
logSwitch = "ERROR"
} else {
logSwitch = "INFO"
}
bfe_debug.DebugIsOpen = false
}

Expand All @@ -84,7 +90,7 @@ func main() {
log4go.SetLogFormat(log4go.FORMAT_DEFAULT_WITH_PID)
log4go.SetSrcLineForBinLog(false)

err = log.Init("bfe", logSwitch, *logPath, *stdOut, "midnight", 7)
err = log.Init("bfe", logSwitch, *logPath, *stdOut || *testConf, "midnight", 7)
if err != nil {
fmt.Printf("bfe: err in log.Init():%s\n", err.Error())
bfe_util.AbnormalExit()
Expand All @@ -97,10 +103,13 @@ func main() {
config, err = bfe_conf.BfeConfigLoad(confPath, *confRoot)
if err != nil {
log.Logger.Error("main(): in BfeConfigLoad():%s", err.Error())
if *testConf {
fmt.Printf("bfe: configuration file %s test failed\n", confPath)
}
bfe_util.AbnormalExit()
}

// maximum number of CPUs (GOMAXPROCS) defaults to runtime.CPUNUM
// maximum number of CPUs (GOMAXPROCS) defaults to runtime.CPUNUM
// if running on machine, or CPU quota if running on container
// (with the help of "go.uber.org/automaxprocs").
// here, we change maximum number of cpus if the MaxCpus is positive.
Expand All @@ -112,11 +121,22 @@ func main() {
bfe_debug.SetDebugFlag(config.Server)

// start and serve
if err = bfe_server.StartUp(config, version, *confRoot); err != nil {
if err = bfe_server.StartUp(config, version, *confRoot, *testConf); err != nil {
log.Logger.Error("main(): bfe_server.StartUp(): %s", err.Error())
}

// waiting for logger finish jobs
time.Sleep(1 * time.Second)
log.Logger.Close()

// output final configuration test result
if *testConf {
if err != nil {
fmt.Printf("bfe: configuration file %s test failed\n", confPath)
bfe_util.AbnormalExit()
} else {
fmt.Printf("bfe: configuration file %s test is successful\n", confPath)
bfe_util.NormalExit()
}
}
}
Loading

0 comments on commit b1f1c66

Please sign in to comment.