001/*
002 * Copyright 2015-2024 the original author or authors
003 *
004 * This software is licensed under the Apache License, Version 2.0,
005 * the GNU Lesser General Public License version 2 or later ("LGPL")
006 * and the WTFPL.
007 * You may choose either license to govern your use of this software only
008 * upon the condition that you accept all of the terms of either
009 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
010 */
011package org.minidns.record;
012
013import org.minidns.dnsname.DnsName;
014import org.minidns.record.Record.TYPE;
015
016import java.io.DataInputStream;
017import java.io.IOException;
018
019/**
020 * CNAME payload (pointer to another domain / address).
021 */
022public class CNAME extends RRWithTarget {
023
024    public static CNAME parse(DataInputStream dis, byte[] data) throws IOException {
025        DnsName target = DnsName.parse(dis, data);
026        return new CNAME(target);
027    }
028
029    public CNAME(String target) {
030        this(DnsName.from(target));
031    }
032
033    public CNAME(DnsName target) {
034        super(target);
035    }
036
037    @Override
038    public TYPE getType() {
039        return TYPE.CNAME;
040    }
041
042}