001/*
002 * Copyright 2015-2020 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 * A DNAME resource record.
021 *
022 * @see <a href="https://tools.ietf.org/html/rfc6672">RFC 6672 - DNAME Redirection in the DNS</a>
023 */
024public class DNAME extends RRWithTarget {
025
026    public static DNAME parse(DataInputStream dis, byte[] data) throws IOException {
027        DnsName target = DnsName.parse(dis, data);
028        return new DNAME(target);
029    }
030
031    public DNAME(String target) {
032        this(DnsName.from(target));
033    }
034
035    public DNAME(DnsName target) {
036        super(target);
037    }
038
039    @Override
040    public TYPE getType() {
041        return TYPE.DNAME;
042    }
043
044}