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