Skip to content

Commit 25bb99e

Browse files
authored
Merge pull request #17 from NodePassProject/main
feat: add a new mechanism for server-side verification of client IP
2 parents 0ba9118 + 6c991e8 commit 25bb99e

27 files changed

+114
-1341
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2525
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2626
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2727
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![GitHub release](https://img.shields.io/github/v/release/yosebyte/nodepass)](https://github.com/yosebyte/nodepass/releases)
55
[![GitHub downloads](https://img.shields.io/github/downloads/yosebyte/nodepass/total.svg)](https://github.com/yosebyte/nodepass/releases)
66
[![Go Report Card](https://goreportcard.com/badge/github.com/yosebyte/nodepass)](https://goreportcard.com/report/github.com/yosebyte/nodepass)
7+
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
78
![GitHub last commit](https://img.shields.io/github/last-commit/yosebyte/nodepass)
89

910
English | [简体中文](README_zh.md)
@@ -32,13 +33,11 @@ English | [简体中文](README_zh.md)
3233
- Smart connection pooling with real-time capacity adaptation
3334
- Dynamic interval adjustment based on network conditions
3435
- Minimal resource footprint even under heavy load
35-
- Automatic recovery from network disruptions
3636

3737
- **🧰 Simple Configuration**
3838
- Zero configuration files required
3939
- Simple command-line parameters
4040
- Environment variables for fine-tuning performance
41-
- Intelligent defaults for most use cases
4241

4342
## 📋 Quick Start
4443

README_zh.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![GitHub release](https://img.shields.io/github/v/release/yosebyte/nodepass)](https://github.com/yosebyte/nodepass/releases)
55
[![GitHub downloads](https://img.shields.io/github/downloads/yosebyte/nodepass/total.svg)](https://github.com/yosebyte/nodepass/releases)
66
[![Go Report Card](https://goreportcard.com/badge/github.com/yosebyte/nodepass)](https://goreportcard.com/report/github.com/yosebyte/nodepass)
7+
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
78
![GitHub last commit](https://img.shields.io/github/last-commit/yosebyte/nodepass)
89

910
[English](README.md) | 简体中文
@@ -32,13 +33,11 @@
3233
- 智能连接池,具备实时容量自适应功能
3334
- 基于网络状况的动态间隔调整
3435
- 高负载下保持最小资源占用
35-
- 网络中断后自动恢复连接
3636

3737
- **🧰 简单配置**
3838
- 零配置文件设计
3939
- 简洁的命令行参数
4040
- 环境变量支持性能精细调优
41-
- 为大多数使用场景提供智能默认值
4241

4342
## 📋 快速开始
4443

cmd/nodepass/core.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"net/url"
66
"time"
77

8+
"github.com/NodePassProject/cert"
89
"github.com/yosebyte/nodepass/internal"
9-
x "github.com/yosebyte/x/tls"
1010
)
1111

1212
// 根据URL方案分派到不同的运行模式
@@ -47,7 +47,7 @@ func runMaster(parsedURL *url.URL) {
4747
// 获取TLS配置
4848
func getTLSProtocol(parsedURL *url.URL) (string, *tls.Config) {
4949
// 生成基本TLS配置
50-
tlsConfig, err := x.GenerateTLSConfig("yosebyte/nodepass:" + version)
50+
tlsConfig, err := cert.NewTLSConfig("yosebyte/nodepass:" + version)
5151
if err != nil {
5252
logger.Error("Generate failed: %v", err)
5353
logger.Warn("TLS code-0: nil cert")
@@ -102,7 +102,7 @@ func getTLSProtocol(parsedURL *url.URL) (string, *tls.Config) {
102102
if cert.Leaf != nil {
103103
logger.Info("TLS code-2: %v with TLS 1.3", cert.Leaf.Subject.CommonName)
104104
} else {
105-
logger.Warn("TLS code-2: unknown with TLS 1.3")
105+
logger.Warn("TLS code-2: unknown cert name with TLS 1.3")
106106
}
107107
return tlsCode, tlsConfig
108108

cmd/nodepass/main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"os"
66
"runtime"
77

8-
"github.com/yosebyte/x/log"
8+
"github.com/NodePassProject/logs"
99
)
1010

1111
var (
1212
// 全局日志记录器
13-
logger = log.NewLogger(log.Info, true)
13+
logger = logs.NewLogger(logs.Info, true)
1414
// 程序版本
1515
version = "dev"
1616
)
@@ -41,26 +41,26 @@ func getParsedURL(args []string) *url.URL {
4141
func initLogLevel(level string) {
4242
switch level {
4343
case "debug":
44-
logger.SetLogLevel(log.Debug)
44+
logger.SetLogLevel(logs.Debug)
4545
logger.Debug("Init log level: DEBUG")
4646
case "warn":
47-
logger.SetLogLevel(log.Warn)
47+
logger.SetLogLevel(logs.Warn)
4848
logger.Warn("Init log level: WARN")
4949
case "error":
50-
logger.SetLogLevel(log.Error)
50+
logger.SetLogLevel(logs.Error)
5151
logger.Error("Init log level: ERROR")
5252
case "fatal":
53-
logger.SetLogLevel(log.Fatal)
53+
logger.SetLogLevel(logs.Fatal)
5454
logger.Fatal("Init log level: FATAL")
5555
default:
56-
logger.SetLogLevel(log.Info)
56+
logger.SetLogLevel(logs.Info)
5757
logger.Info("Init log level: INFO")
5858
}
5959
}
6060

6161
// 输出帮助信息并退出程序
6262
func getExitInfo() {
63-
logger.SetLogLevel(log.Info)
63+
logger.SetLogLevel(logs.Info)
6464
logger.Info(`Version: %v %v/%v
6565
6666
╭─────────────────────────────────────────────────────────────╮

docs/en/api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,6 @@ For example:
634634
http://localhost:9090/api/v1/docs
635635
```
636636

637-
![np-api](https://cdn.yobc.de/assets/np-api.png)
638-
639637
The Swagger UI provides a convenient way to explore and test the API directly in your browser. You can execute API calls against your running NodePass Master instance and see the actual responses.
640638

641639
## Best Practices

docs/en/configuration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ NodePass behavior can be fine-tuned using environment variables. Below is the co
5757
| `NP_MAX_POOL_CAPACITY` | Maximum connection pool size | 1024 | `export NP_MAX_POOL_CAPACITY=4096` |
5858
| `NP_UDP_DATA_BUF_SIZE` | Buffer size for UDP packets | 8192 | `export NP_UDP_DATA_BUF_SIZE=16384` |
5959
| `NP_UDP_READ_TIMEOUT` | Timeout for UDP read operations | 5s | `export NP_UDP_READ_TIMEOUT=10s` |
60+
| `NP_TCP_READ_TIMEOUT` | Timeout for TCP read operations | 5s | `export NP_TCP_READ_TIMEOUT=10s` |
6061
| `NP_UDP_DIAL_TIMEOUT` | Timeout for establishing UDP connections | 5s | `export NP_UDP_DIAL_TIMEOUT=10s` |
6162
| `NP_TCP_DIAL_TIMEOUT` | Timeout for establishing TCP connections | 5s | `export NP_TCP_DIAL_TIMEOUT=10s` |
6263
| `NP_MIN_POOL_INTERVAL` | Minimum interval between connection creations | 1s | `export NP_MIN_POOL_INTERVAL=500ms` |
@@ -116,6 +117,20 @@ For applications relying heavily on UDP traffic:
116117
- Increase for high-latency networks or applications with slow response times
117118
- Decrease for low-latency applications requiring quick failover
118119

120+
### TCP Settings
121+
122+
For optimizing TCP connections:
123+
124+
- `NP_TCP_READ_TIMEOUT`: Timeout for TCP read operations
125+
- Increase for high-latency networks or servers with slow response times
126+
- Decrease for applications that need to detect disconnections quickly
127+
- Affects wait time during data transfer phases
128+
129+
- `NP_TCP_DIAL_TIMEOUT`: Timeout for establishing TCP connections
130+
- Increase for unstable network conditions
131+
- Decrease for applications that need quick connection success/failure determination
132+
- Affects initial connection establishment phase
133+
119134
### Service Management Settings
120135

121136
- `NP_REPORT_INTERVAL`: Controls how frequently health status is reported

docs/en/installation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ After installation, verify that NodePass is correctly installed by checking the
9696
nodepass
9797
```
9898

99-
![np-cli](https://cdn.yobc.de/assets/np-cli.png)
100-
10199
## Next Steps
102100

103101
Now that you have NodePass installed, you can:
-7.67 KB
Binary file not shown.
-33.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)