Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Enable DNS proxy by default #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# DASLink
DASLink is a simple tool to link ipfs content from [DAS](https://da.systems/).
DASLink is a simple tool to link ipfs content from [.bit](https://www.did.id/).

## How does it work?
Dependent on [DNSLink](https://docs.ipfs.io/concepts/dnslink/), [Cloudflare ipfs gateway](https://developers.cloudflare.com/distributed-web/ipfs-gateway), [Cloudflare DNS](https://api.cloudflare.com/#dns-records-for-a-zone-properties) and [das-database](https://github.com/DeAccountSystems/das-database).
Dependent on [DNSLink](https://docs.ipfs.io/concepts/dnslink/), [Cloudflare ipfs gateway](https://developers.cloudflare.com/distributed-web/ipfs-gateway), [Cloudflare DNS](https://api.cloudflare.com/#dns-records-for-a-zone-properties) and [das-database](https://github.com/dotbitHQ/das-database).

```
┌───────────┐ ┌───────────┐ ┌────────────┐
Expand Down Expand Up @@ -37,7 +37,7 @@ Dependent on [DNSLink](https://docs.ipfs.io/concepts/dnslink/), [Cloudflare ipfs
## Install
```
# run das-database and keep it synchronized with the latest data
https://github.com/DeAccountSystems/das-database
https://github.com/dotbitHQ/das-database

# get the code
git clone https://github.com/paicha/daslink.git
Expand Down
7 changes: 3 additions & 4 deletions dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ func (d *DNSData) updateDNSRecord(contentRecord dao.TableRecordsInfo) (dao.Table
if recordType == "CNAME" {
oldRecords = *d.cnameRecords
content := d.ipfsCname
proxied := new(bool)
proxied := true
// CNAME content for skynet
if contentRecord.Key == "skynet" {
content = d.skynetCname
*proxied = true
}
newRecord = cloudflare.DNSRecord{
Type: recordType,
Name: contentRecord.Account + d.hostNameSuffix,
Content: content,
TTL: ttl,
Proxied: proxied,
Proxied: &proxied,
}
} else if recordType == "TXT" {
oldRecords = *d.txtRecords
Expand Down Expand Up @@ -124,7 +123,7 @@ func (d *DNSData) updateDNSRecord(contentRecord dao.TableRecordsInfo) (dao.Table
if newRecord.Name == oldRecordName {
log.Infof("%s record exist: %s", recordType, newRecord.Name)
recordExist = true
if newRecord.Content != oldRecord.Content || newRecord.TTL != oldRecord.TTL {
if newRecord.Content != oldRecord.Content || (recordType == "TXT" && newRecord.TTL != oldRecord.TTL) {
log.Infof("%s record exist and NEED to update: %s", recordType, newRecord.Name)
oldRecordId = oldRecord.ID
}
Expand Down