Dragonfly2

Форк
0
/
peerhost_darwin.go 
190 строк · 4.6 Кб
1
//go:build darwin
2

3
/*
4
 *     Copyright 2020 The Dragonfly Authors
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *      http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18

19
package config
20

21
import (
22
	"time"
23

24
	"golang.org/x/time/rate"
25

26
	"d7y.io/dragonfly/v2/client/util"
27
	"d7y.io/dragonfly/v2/pkg/net/fqdn"
28
	"d7y.io/dragonfly/v2/pkg/rpc"
29
	"d7y.io/dragonfly/v2/pkg/types"
30
)
31

32
var peerHostConfig = func() *DaemonOption {
33
	return &DaemonOption{
34
		AliveTime:   util.Duration{Duration: DefaultDaemonAliveTime},
35
		GCInterval:  util.Duration{Duration: DefaultGCInterval},
36
		KeepStorage: false,
37
		Scheduler: SchedulerOption{
38
			Manager: ManagerOption{
39
				Enable:          false,
40
				RefreshInterval: 10 * time.Minute,
41
				SeedPeer: SeedPeerOption{
42
					Enable:    false,
43
					Type:      types.HostTypeSuperSeedName,
44
					ClusterID: 1,
45
					KeepAlive: KeepAliveOption{
46
						Interval: 5 * time.Second,
47
					},
48
				},
49
			},
50
			ScheduleTimeout: util.Duration{Duration: DefaultScheduleTimeout},
51
		},
52
		Host: HostOption{
53
			Hostname: fqdn.FQDNHostname,
54
			Location: "",
55
			IDC:      "",
56
		},
57
		Download: DownloadOption{
58
			CalculateDigest:      true,
59
			PieceDownloadTimeout: 30 * time.Second,
60
			GRPCDialTimeout:      10 * time.Second,
61
			WatchdogTimeout:      30 * time.Second,
62
			GetPiecesMaxRetry:    100,
63
			RecursiveConcurrent: RecursiveConcurrent{
64
				GoroutineCount: 32,
65
			},
66
			TotalRateLimit: util.RateLimit{
67
				Limit: rate.Limit(DefaultTotalDownloadLimit),
68
			},
69
			PerPeerRateLimit: util.RateLimit{
70
				Limit: rate.Limit(DefaultPerPeerDownloadLimit),
71
			},
72
			DownloadGRPC: ListenOption{
73
				Security: SecurityOption{
74
					Insecure:  true,
75
					TLSVerify: false,
76
				},
77
				UnixListen: &UnixListenOption{},
78
			},
79
			PeerGRPC: ListenOption{
80
				Security: SecurityOption{
81
					Insecure:  true,
82
					TLSVerify: true,
83
				},
84
				TCPListen: &TCPListenOption{
85
					PortRange: TCPListenPortRange{
86
						Start: DefaultPeerStartPort,
87
						End:   DefaultEndPort,
88
					},
89
				},
90
			},
91
			SplitRunningTasks: false,
92
		},
93
		Upload: UploadOption{
94
			RateLimit: util.RateLimit{
95
				Limit: rate.Limit(DefaultUploadLimit),
96
			},
97
			ListenOption: ListenOption{
98
				Security: SecurityOption{
99
					Insecure:  true,
100
					TLSVerify: false,
101
				},
102
				TCPListen: &TCPListenOption{
103
					PortRange: TCPListenPortRange{
104
						Start: DefaultUploadStartPort,
105
						End:   DefaultEndPort,
106
					},
107
				},
108
			},
109
		},
110
		ObjectStorage: ObjectStorageOption{
111
			Enable:      false,
112
			Filter:      "Expires&Signature&ns",
113
			MaxReplicas: DefaultObjectMaxReplicas,
114
			ListenOption: ListenOption{
115
				Security: SecurityOption{
116
					Insecure:  true,
117
					TLSVerify: true,
118
				},
119
				TCPListen: &TCPListenOption{
120
					PortRange: TCPListenPortRange{
121
						Start: DefaultObjectStorageStartPort,
122
						End:   DefaultEndPort,
123
					},
124
				},
125
			},
126
		},
127
		Proxy: &ProxyOption{
128
			ListenOption: ListenOption{
129
				Security: SecurityOption{
130
					Insecure:  true,
131
					TLSVerify: false,
132
				},
133
				TCPListen: &TCPListenOption{
134
					PortRange: TCPListenPortRange{},
135
				},
136
			},
137
		},
138
		Storage: StorageOption{
139
			TaskExpireTime: util.Duration{
140
				Duration: DefaultTaskExpireTime,
141
			},
142
			StoreStrategy:          SimpleLocalTaskStoreStrategy,
143
			Multiplex:              false,
144
			DiskGCThresholdPercent: 95,
145
		},
146
		Health: &HealthOption{
147
			ListenOption: ListenOption{
148
				Security: SecurityOption{
149
					Insecure:  true,
150
					TLSVerify: false,
151
				},
152
				TCPListen: &TCPListenOption{
153
					PortRange: TCPListenPortRange{
154
						Start: DefaultHealthyStartPort,
155
						End:   DefaultEndPort,
156
					},
157
				},
158
			},
159
			Path: "/server/ping",
160
		},
161
		Reload: ReloadOption{
162
			Interval: util.Duration{
163
				Duration: time.Minute,
164
			},
165
		},
166
		Security: GlobalSecurityOption{
167
			AutoIssueCert: false,
168
			CACert:        types.PEMContent(""),
169
			TLSVerify:     false,
170
			TLSPolicy:     rpc.PreferTLSPolicy,
171
			CertSpec: &CertSpec{
172
				DNSNames:       DefaultCertDNSNames,
173
				IPAddresses:    DefaultCertIPAddresses,
174
				ValidityPeriod: DefaultCertValidityPeriod,
175
			},
176
		},
177
		Network: &NetworkOption{
178
			EnableIPv6: false,
179
		},
180
		Announcer: AnnouncerOption{
181
			SchedulerInterval: DefaultAnnouncerSchedulerInterval,
182
		},
183
		NetworkTopology: NetworkTopologyOption{
184
			Enable: false,
185
			Probe: ProbeOption{
186
				Interval: DefaultProbeInterval,
187
			},
188
		},
189
	}
190
}
191

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.