distronaut
1.0.0
Distronaut เป็นเครื่องมือที่เดินทางผ่านอินเทอร์เน็ตเพื่อค้นหาลิงค์การกระจาย ISO และข้อมูลเมตาทำให้ง่ายขึ้นสำหรับคุณในการตรวจสอบรุ่นใหม่เบิร์นติดตั้งสื่อหรือสร้างคลังเก็บ ISO Bank ของคุณเอง
ใช้ไบนารีที่สร้างไว้ล่วงหน้า:
go install github.com/ovh/distronaut@latestอาคารจากแหล่งกำเนิด
make ใช้คำสั่ง fetch เพื่อดึง JSON จากแหล่งที่กำหนดค่า:
distronaut fetch -c config/sources.yml -f ' debian 'เอาต์พุตคล้ายกับด้านล่าง:
[
{
"source" : " Debian " ,
"family" : " Linux " ,
"distribution" : " Debian (formerly Debian GNU/Linux) " ,
"website" : " http://www.debian.org/ " ,
"documentation" : " http://www.debian.org/doc/ " ,
"status" : " Active " ,
"logo" : " https://distrowatch.com/images/yvzhuwbpy/debian.png " ,
"logo64" : " data:image/png;base64,... " ,
"versions" : [
{
"url" : " https://cdimage.debian.org/cdimage/archive/12.6.0/amd64/iso-cd/debian-12.6.0-amd64-netinst.iso " ,
"hash" : " sha256:ade3a4acc465f59ca2496344aab72455945f3277a52afc5a2cae88cdc370fa12 " ,
"hashfile" : " https://cdimage.debian.org/cdimage/archive/12.6.0/amd64/iso-cd/SHA256SUMS " ,
"version" : " 12.6.0 " ,
"arch" : " amd64 " ,
"meta" : {
"release" : " 2023-06-10 "
}
}
]
}
]ข้อมูลเมตาเพิ่มเติมถูกทิ้งจาก distrowatch.com
แพ็คเกจนี้ยังสามารถนำเข้าภายใน Golang Codebase อื่น:
package main
import (
"encoding/json"
"fmt"
"github.com/ovh/distronaut/pkg/distro"
)
func main () {
src , _ := distro . FetchSources ( "config/sources.yml" , "debian" )
j , _ := json . MarshalIndent ( src , "" , " " )
fmt . Println ( string ( j ))
}เปิดไฟล์การกำหนดค่าของคุณและเพิ่มรายการใหม่ที่มี:
name เป็นชื่อที่เป็นมิตรสำหรับแหล่งใหม่ของคุณ (สามารถใช้สำหรับการกรอง)url เป็นรูปแบบ URL ต้นฉบับ:patterns คือแผนที่ที่มี::* เป็นรูปแบบ regex ที่ตรงกับ พารามิเตอร์เส้นทาง ที่กำหนดไว้k<:name> ไวยากรณ์.hash.* มีการตั้งค่าที่เกี่ยวข้องกับแฮชทั้งหมด.hash.file เป็นรูปแบบ regex ที่ตรงกับไฟล์ที่มีแฮช.hash.pattern เป็นรูปแบบ regex ที่จับแฮชจาก ISO ที่กำหนด (ซึ่งสามารถอ้างอิงย้อนกลับด้วย k<iso> ).hash.algo เป็นชื่อของอัลกอริทึมแฮช.meta.* มีการตั้งค่าข้อมูลเมตาทั้งหมดที่เกี่ยวข้อง.meta.source ต้องตั้งค่าเป็น distrowatch (รองรับเฉพาะข้อมูลเมตาดาต้าเท่านั้น).meta.id เป็นที่จับ distro บน distrowatch.meta.version เป็นรูปแบบ regex ที่ตรงกับรุ่นตามที่อ้างอิงใน distrowatchตัวอย่างแหล่งที่มา:
- name : Debian
url : https://cdimage.debian.org/debian-cd/:version/:arch/iso-cd/:iso
patterns :
:version : ^(d+.d+(?:.d+)?)/$
:arch : ^(amd64|arm64)/$
:iso : ^debian-k<version>-k<arch>-netinst.iso$
.hash.file : SHA256SUMS
.hash.algo : sha256
.hash.pattern : (?m)^([0-9a-f]{64})s+k<iso>
.meta.source : distrowatch
.meta.id : debian
.meta.version : (d+)โปรดอ่านแนวทางการบริจาคของเราก่อน (สนับสนุน. md)
เรียกใช้การทดสอบโดยใช้:
make testเซิร์ฟเวอร์ล้อเลียนจะถูกวางไข่ชั่วคราวบนพอร์ต 3000 เพื่อหลีกเลี่ยงการดำเนินการตามคำขอเครือข่ายจริง
Copyright 2021 OVH SAS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.