mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-10 17:45:41 +03:00
Pull request: all: replace uuid pkg; upd deps
Merge in DNS/adguard-home from 4622-upd-deps to master Squashed commit of the following: commit 36f407d8ab103da0f7eacdf91c153c23a5b7c3f2 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Jun 3 15:22:47 2022 +0300 home: imp mobileconfig uuid gen commit dddd162461a4830f7c0636338430cd6e77199214 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Jun 3 13:54:29 2022 +0300 all: replace uuid pkg; upd deps
This commit is contained in:
parent
f46c9f74d5
commit
cbe32c5a73
3 changed files with 22 additions and 25 deletions
internal/home
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
|
||||
"github.com/AdguardTeam/golibs/errors"
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/google/uuid"
|
||||
"howett.net/plist"
|
||||
)
|
||||
|
||||
|
@ -47,9 +47,9 @@ type payloadContent struct {
|
|||
|
||||
PayloadType string
|
||||
PayloadIdentifier string
|
||||
PayloadUUID string
|
||||
PayloadDisplayName string
|
||||
PayloadDescription string
|
||||
PayloadUUID uuid.UUID
|
||||
PayloadVersion int
|
||||
}
|
||||
|
||||
|
@ -63,18 +63,14 @@ const dnsSettingsPayloadType = "com.apple.dnsSettings.managed"
|
|||
type mobileConfig struct {
|
||||
PayloadDescription string
|
||||
PayloadDisplayName string
|
||||
PayloadIdentifier string
|
||||
PayloadType string
|
||||
PayloadUUID string
|
||||
PayloadContent []*payloadContent
|
||||
PayloadIdentifier uuid.UUID
|
||||
PayloadUUID uuid.UUID
|
||||
PayloadVersion int
|
||||
PayloadRemovalDisallowed bool
|
||||
}
|
||||
|
||||
func genUUIDv4() string {
|
||||
return uuid.NewV4().String()
|
||||
}
|
||||
|
||||
const (
|
||||
dnsProtoHTTPS = "HTTPS"
|
||||
dnsProtoTLS = "TLS"
|
||||
|
@ -104,23 +100,23 @@ func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) {
|
|||
return nil, fmt.Errorf("bad dns protocol %q", proto)
|
||||
}
|
||||
|
||||
payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4())
|
||||
payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, uuid.New())
|
||||
data := &mobileConfig{
|
||||
PayloadDescription: "Adds AdGuard Home to macOS Big Sur " +
|
||||
"and iOS 14 or newer systems",
|
||||
PayloadDescription: "Adds AdGuard Home to macOS Big Sur and iOS 14 or newer systems",
|
||||
PayloadDisplayName: dspName,
|
||||
PayloadIdentifier: genUUIDv4(),
|
||||
PayloadType: "Configuration",
|
||||
PayloadUUID: genUUIDv4(),
|
||||
PayloadContent: []*payloadContent{{
|
||||
DNSSettings: d,
|
||||
|
||||
PayloadType: dnsSettingsPayloadType,
|
||||
PayloadIdentifier: payloadID,
|
||||
PayloadUUID: genUUIDv4(),
|
||||
PayloadDisplayName: dspName,
|
||||
PayloadDescription: "Configures device to use AdGuard Home",
|
||||
PayloadUUID: uuid.New(),
|
||||
PayloadVersion: 1,
|
||||
DNSSettings: d,
|
||||
}},
|
||||
PayloadIdentifier: uuid.New(),
|
||||
PayloadUUID: uuid.New(),
|
||||
PayloadVersion: 1,
|
||||
PayloadRemovalDisallowed: false,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue